My problem is how to load .js files from the vendors folder in CakePHP 3.0. I have included twitter bootstrap via composer. The .js file is located in /vendor/twbs/bootstrap-sass/assets/javascripts/ folder. I don't want to move it to webroot because then I'll break the auto-update functionality provided from composer. Any good suggestions? I don't want to duplicate files and loose the composer benefits...
相关问题
- How to add a “active” class to a carousel first el
- Full Clickable Accordion in Bootstrap
- How to add Bootstrap 4 without Tether?
- Laravel overriding bootstrap template
- How to add Labels to Bootstrap dialog footer
相关文章
- Make Bootstrap tab Active on the bases of URL link
- Rails: Twitter Bootstrap Buttons when visited get
- Reduce spacing between rows
- How do use bootstrap tooltips with React?
- Need to design 8 boxes in two rows
- Trigger a Bootstrap .collapse('toggle') vi
- How to override Bootstrap mixin without modifying
- How can I ensure columns wrap equally in Twitter B
Same with mutdsu's answer but with more details.
In composer.json, under scripts, add the line:
it should show something like this:
In src/Console/Installer.php, add these two static functions:
If you are using git, please make sure to add these lines to your .gitignore file:
I've found a solution! If I'm using composer why not to use it for this too, right? :)
In composer.json:
In src/Console/Installer.php:
And finally if you are using git add webroot/bootstrap.js to .gitignore. The postUpdate runs after every composer update command, so if you want to run the script after every actual package update just use post-package-update instead of post-update-cmd.
I don't like to copy files so based on previous answers i have created function which create links to bootstrap files. Note, that for Bootstrap4, which distributed without fonts now.