Skip to content

Instantly share code, notes, and snippets.

@chrismccord

chrismccord/1.js

Forked from net/1.js
Created Apr 7, 2016
Embed
What would you like to do?
Adding Bootstrap to Phoenix using NPM
// 1. Add Bootstrap as a dependency in package.json
{
...
"dependencies": {
...
"bootstrap": "~3.3.6"
}
}
// 2. Modify brunch-config.js
exports.config = {
...
npm: {
enabled: true,
// Whitelist the npm deps to be pulled in as front-end assets.
// All other deps in package.json will be excluded from the bundle.
whitelist: ["phoenix", "phoenix_html"],
styles: {bootstrap: ["dist/css/bootstrap.css"]}
}
};
@michaelforrest

This comment has been minimized.

Copy link

@michaelforrest michaelforrest commented Apr 28, 2016

Where will the styles end up here - included in app.css?

@KZeillmann

This comment has been minimized.

Copy link

@KZeillmann KZeillmann commented Aug 6, 2016

How is bootstrap.js loaded?

@linges

This comment has been minimized.

Copy link

@linges linges commented Jan 5, 2017

You can add import "bootstrap" to your app.js.
Make sure to include jQuery as npm dependency and add this to the brunch-config:

npm: {
      globals: {
          $: 'jquery',
          jQuery: 'jquery'
      }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment