OSDN Git Service

Regular updates
[twpd/master.git] / brunch.md
1 ---
2 title: Brunch
3 category: JavaScript libraries
4 ---
5
6 ## Paths
7
8     /
9       app/
10         assets/
11       vendor/
12       public/
13       config.coffee
14
15 ## Config
16
17 ```js
18 module.exports = {
19   files: {
20     javascripts: {  # or 'stylesheets' or 'templates'
21       order: {
22         before: [ 'normalize.css' ],
23         after:  [ 'helpers.css' ],
24
25       joinTo: 'app.js',
26       joinTo: {
27         'js/app.js':    /^app/,
28         'js/vendor.js': /^vendor/
29       },
30       pluginHelpers: 'js/vendor.js'
31     }
32   }
33
34   paths: {
35     public: 'public',                      # where to compile
36     watched: ['app','test','vendor'],      # what to monitor
37  }
38
39   modules: {
40     wrapper: 'amd',
41     definition: 'amd',
42     nameCleaner: (path) => path.replace(/^app\//, '')
43   }
44
45   npm: { styles, globals }
46
47   plugins: {
48     sass: { ... }
49   }
50
51   // brunch w --apply testing
52   // BRUNCH_ENV=testing brunch build
53   overrides: {
54     production: {
55       optimize: true,
56       sourceMaps: false,
57       plugins: { autoReload: { enabled: false } }
58     }
59   }
60
61   onCompile: (files, assets) => { ... }
62 ```
63
64 ## Plugins
65
66     plugins:
67       uglify:
68         mangle: true
69         compress:
70           global_defs:
71             DEBUG: false
72
73 ## Extensions
74
75 Compile to CSS
76
77   * stylus-brunch
78   * less-brunch
79   * sass-brunch
80
81 Compile to HTML
82
83   * static-jade-brunch
84
85 Embedded templates
86
87   * emblem-brunch
88
89 Etc
90
91   * uglify-js-brunch
92   * jshint-brunch
93   * imageoptimizer-brunch
94
95 ## References
96
97   * <https://github.com/brunch/brunch/blob/master/docs/config.md>