Guest User

Untitled

a guest
Jul 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. * ###### Tested with Phoenix 1.3
  2.  
  3. ## 1) Installing sass, font-awesome and bootstrap package's using Brunch
  4.  
  5. First, install the Sass, Font Awesome, bootstrap(and deps) package:
  6.  
  7. `cd assets`
  8.  
  9. - npm install --save-dev sass-brunch
  10. - npm install --save font-awesome
  11. - npm install --save copycat-brunch
  12. - npm install --save jquery
  13. - npm install --save bootstrap
  14. - npm install --save tether (bootstrap dep)
  15. - npm install --save popper.js (bootstrap dep)
  16.  
  17. ## 2) Create folder fonts assets (because brunch will search and copy this folder)
  18.  
  19. - You must create a folder `fonts` in path "assets/static" (`assets/static/fonts`)
  20. - cd assets/static
  21. - mkdir fonts
  22. - cd fonts
  23. - touch .gitkeep (you must create this to persist in git repo)
  24.  
  25. In the end you will have a folder like `/assets/static/fonts` containing the fonts
  26.  
  27. ## 3) Update brunch-config.js (look the brunch-config.js attached)
  28. - Add saas config and copycat:
  29.  
  30. ```
  31. sass: {
  32. mode: 'native',
  33. options: {
  34. includePaths: ["node_modules/font-awesome/scss", "node_modules/bootstrap/scss"], // Tell sass-brunch where to look for files to @import
  35. precision: 8 // Minimum precision required by bootstrap-sass
  36. }
  37. },
  38. copycat: {
  39. "fonts" : ["static/fonts", "node_modules/font-awesome/fonts"],
  40. verbose : false, //shows each file that is copied to the destination directory
  41. onlyChanged: true //only copy a file if it's modified time has changed (only effective when using brunch watch)
  42. }
  43. ```
  44.  
  45. - Add "scss", "fonts" to your paths/watcher
  46.  
  47.  
  48. ```
  49. paths: {
  50. // Dependencies and current project directories to watch
  51. watched: ["static", "css", "js", "vendor","scss", "fonts"],
  52. // Where to compile files to
  53. public: "../priv/static"
  54. }
  55. ```
  56. - Update npm config
  57.  
  58. ```
  59. npm: {
  60. enabled: true,
  61. globals: { // Bootstrap's JavaScript requires both '$' and 'jQuery' in global scope
  62. $: 'jquery',
  63. jQuery: 'jquery',
  64. Tether: 'tether',
  65. Popper: 'popper.js',
  66. bootstrap: 'bootstrap', // Require Bootstrap's JavaScript globally
  67. }
  68. }
  69. ```
  70.  
  71. ## 4) Rename web/static/css/app.css to web/static/css/app.sass and add @import (look file attached)
  72.  
  73. - add `@import 'font-awesome';`
  74. - add `@import 'bootstrap';`
Add Comment
Please, Sign In to add comment