Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPM Bootstrap #9

Open
djmtype opened this issue May 5, 2018 · 1 comment
Open

NPM Bootstrap #9

djmtype opened this issue May 5, 2018 · 1 comment

Comments

@djmtype
Copy link

djmtype commented May 5, 2018

Since Bootstrap no longer utilizes Bower, it's probably preferred to use NPM. Adding @import "../../node_modules/bootstrap/scss/bootstrap"; to main.scss is easy to figure out, but what about each of Bootstrap's JS files along with the jQuery and Popper.js dependencies. What's the best way of calling these files while still taking advantage of the manifest.json for production builds?

@djmtype
Copy link
Author

djmtype commented May 5, 2018

One way is to include the files directly to the manifest.json.

"bootstrap.js": {
	"files": [	
	"../node_modules/bootstrap/js/dist/transition.js",
        "../node_modules/bootstrap/js/dist/alert.js",
        "../node_modules/bootstrap/js/dist/button.js",
        "../node_modules/bootstrap/js/dist/carousel.js",
        "../node_modules/bootstrap/js/dist/collapse.js",
        "../node_modules/bootstrap/js/dist/dropdown.js",
        "../node_modules/bootstrap/js/dist/modal.js",
        "../node_modules/bootstrap/js/dist/tooltip.js",
        "../node_modules/bootstrap/js/dist/popover.js",
        "../node_modules/bootstrap/js/dist/scrollspy.js",
        "../node_modules/bootstrap/js/dist/tab.js",
        "../node_modules/bootstrap/js/dist/util.js"
      ]
}

Then, enqueue bootstrap.js in the setup.php file.

Unfortunately, jshint will try and lint these files – which brings up alot of warnings.

Despite every option found here, the method that worked for me was to create a .jshintignore file specified with node_modules NOT node_modules/*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant