Created
February 23, 2016 10:50
-
-
Save anonymous/a8b0ccb9bcc5df658a18 to your computer and use it in GitHub Desktop.
Use bootstrap-sass npm package with Phoenix's brunch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) install npm packages | |
2) update brunch-config.js | |
3) remove Bootstrap from web/static/css/app.css | |
4) rename web/static/css/app.css to web/static/css/app.scss | |
5) update web/static/css/app.scss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$icon-font-path: "/fonts/"; /* use fonts from priv/static/fonts/ */ | |
@import "bootstrap"; /* imports node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.config = { | |
plugins: { | |
sass: { | |
includePaths: ["node_modules/bootstrap-sass/assets/stylesheets"], // tell sass-brunch where to look for files to @import | |
precision: 8 // minimum precision required by bootstrap-sass | |
}, | |
copycat: { | |
"fonts": ["node_modules/bootstrap-sass/assets/fonts/bootstrap"] // copy node_modules/bootstrap-sass/assets/fonts/bootstrap/* to priv/static/fonts/ | |
} | |
}, | |
modules: { | |
autoRequire: { | |
"js/app.js": [ | |
"bootstrap-sass", // require bootstrap-sass' JavaScript globally | |
"web/static/js/app" | |
] | |
} | |
}, | |
npm: { | |
enabled: true, | |
whitelist: ["phoenix", "phoenix_html", "jquery", "bootstrap-sass"], // pull jquery and bootstrap-sass in as front-end assets | |
globals: { // bootstrap-sass' JavaScript requires both '$' and 'jQuery' in global scope | |
$: 'jquery', | |
jQuery: 'jquery' | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save bootstrap-sass sass-brunch jquery copycat-brunch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Forgot to log in. Use this one: https://gist.github.com/ciastek/ae1b209543d4b2d03906