UNPKG

3.21 kBMarkdownView Raw
1# Welcome to Buildr
2
3The (Java|Coffee)Script and (CSS|Less) (Builder|Bundler|Packer|Minifier|Merger|Checker)
4
5
6## Install
7
81. [Install Node.js](https://github.com/balupton/node/wiki/Installing-Node.js)
9
101. Install [CoffeeScript](http://jashkenas.github.com/coffee-script/)
11
12 npm -g install coffeescript
13
141. If you also want image compression, do this:
15
16 - On OSX
17
18 ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
19 brew install gifsicle libjpeg optipng pngcrush
20
21 - On Apt Linux
22
23 sudo apt-get update && sudo apt-get install gifsicle libjpeg-progs optipng pngcrush
24
25 - On Yum Linux
26
27 sudo yum -y install gifsicle libjpeg-progs optipng pngcrush
28
29 - Windows
30
31 > Hahahahaha
32
33
34## Configure
35
36Before you use Buildr, you must specify some configuration for it. Here is an example:
37
38``` coffeescript
39 {
40 srcPath: 'src'
41 outPath: 'out'
42 compress: true
43 srcLoaderPath: 'src/loader.js'
44 outStylePath: 'out/styles.css'
45 outScriptPath: 'out/scripts.js'
46 scripts: [
47 'scripts/file1.js'
48 'scripts/file2.coffee'
49 ]
50 styles: [
51 'styles/file1.css'
52 'styles/file2.less'
53 ]
54 }
55```
56
57Which works great for the following app structure:
58
59> - app
60 - src
61 - scripts
62 - file1.js
63 - file2.coffee
64 - styles
65 - file1.css
66 - file2.less
67
68Using that configuration with buildr will:
69
701. Copy `app/src` to `app/out`
711. Generate `src/loader.js` which loads in the original styles and scripts into your page; use this file for development
721. Generates `out/styles.css` and `out/scripts.js` which are all your styles and scripts compressed and bundled together respectively; use these files for production
73
74If you'd prefer to have the `srcPath` and the `outPath` the same, you can do that too.
75
76
77## Run
78
79### As a Command Line Tool
80
81_Note: this option is currently disabled due to [this bug](https://github.com/balupton/buildr.npm/issues/8)_
82
831. Install Buildr Globally
84
85 npm -g install buildr
86
872. Stick your configuration in `app/buildr.cson`
88
893. Within your app root, run `buildr`
90
91
92### As a Module
93
941. Install Buildr Locally
95
96 npm install buildr
97
982. Code
99
100 ``` coffeescript
101 buildr = require 'buildr'
102 config = {} # your configuration
103 myBuildr = buildr.createInstance(config)
104 myBuildr.process (err) ->
105 throw err if err
106 console.log 'Building completed'
107 ```
108
109
110## License
111
112Licensed under the [MIT License](http://creativecommons.org/licenses/MIT/)
113Copyright 2011 [Benjamin Arthur Lupton](http://balupton.com)
114
115
116## History
117
118### Stability
119
120- [Current Stable Release: 0.2](https://github.com/balupton/buildr.npm/tree/0.2)
121- [Current Beta Release: 0.5](https://github.com/balupton/buildr.npm/tree/0.5)
122
123To install a specific version, say version 0.2, run `npm install buildr@0.2`
124
125### Changelog
126
127- v0.5 July 9, 2011
128 - Added srcLoader compilation
129
130- v0.4 July 1, 2011
131 - Extremely Simplified
132
133- v0.3 May 31, 2011
134 - Exploration into better architectures
135
136- v0.2 April 2, 2011
137 - Initial Release
138
139- v0.1 March 23, 2011
140 - Initial Commit
141
142### Todo
143
144- Needs javascript compression re-added
145- Needs image compression re-added
146- Needs auto file finding
147- Needs jshint checking on `.js` files (not `.coffee` files)
148- Needs no-config version
149- Needs unit tests for the first time
\No newline at end of file