UNPKG

12.3 kBJavaScriptView Raw
1/*global */
2var mainMenuTree = [
3 // { label: 'Home', icon: '', route: 'home'
4 // // sub: [
5 // // { label: 'Contact us', route: 'contactus', scroll: true}
6 // // ]
7 // }
8];
9
10var slides = [
11 // { url: "images/slides/home_page_Early_Childhood_Education_and_Care_training.jpg"
12 // // ,title: 'Early Childhood Education and Care training'
13 // // ,subtitle: 'Aged care slogan'
14 // }
15];
16
17var develop_mode = process.env.DEVELOP;
18var exports = {
19 verbose: true
20 ,printMap: false
21 ,prettyPrintHtml: false
22 // ,tagIdPostfix: '__' //can be overridden per template
23 ,paths: {
24 root: process.cwd()
25 //relative to this root:
26 ,partials: 'build/' //can be overridden per template
27 ,www: 'www'
28 ,out:'built'
29 ,js: 'scripts'
30 }
31 /*
32 If cachify if falsy resources will be requested as is, without a
33 stamp. Which means bb-server will send them with max-age=0 and
34 expires=[data-in-the-past], which means any caching mechanism will call
35 back to the server to ask for an update.
36
37 If cachify is truthy all requests for files with the following extensions
38 will be stamped by prepending a sha1 hash checksum to the path to the
39 file, in other words, uniquifying the request for a particular version
40 of a file:
41
42 css js jpg jpeg gif ico png bmp pict csv doc pdf pls ppt tif tiff eps swf midi
43 mid ttf eot woff svg svgz webp docx xlsx xls pptx ps
44
45 (https://support.cloudflare.com/hc/en-us/articles/200172516-What-file-extensions-does-CloudFlare-cache-for-static-content-)
46
47 This will only work if the server serving the files is able to strip these
48 stamps before processing the request
49
50 If this option (stamp) is truthy, by default bb-server sets
51 max-age=[one-year] and expires=[one-year-in-the-future] (see the cache and
52 stamp settings of bb-server) of responses to requests for stamped
53 files. If not turned on it will respond with lots of 404's :-).
54
55 To opt out for a particular extension, list it under exclude. Requests for
56 these files will be for the real filename, maybe set cache-control:
57 max-age=[1day].
58
59 To use mtime instead of a hash to uniqify a request for a file with a
60 particular extension, list the extension under mtime. This will speed up
61 html-builder if you are cachefying lots of resources, however it will not
62 work if you replace a newer file with an older one, like a pdf file with a
63 another pdf file of the same name, but created before the first one. You'd
64 have to use the linux command touch on it first.
65
66
67 Possibly implement a manifest, so a file that maps filename to its hash
68 and version number, you could get away with a much smaller stamp. Possibly
69 two char if you have variable length and let bb-server recognize the stamp
70 by a prefix. Only risk is to loose the manifest.
71 */
72 ,cachify: !develop_mode
73 // ,cachify: true
74 //hash or mtime, query or modified filename
75 // ,cachify : {
76 // exclude: ['doc', 'docx'] //for instance ['pdf', 'doc']
77 // ,method: 'sha1' //mtime or any of the hashes returned from crypto.getHashes()
78 // // (var crypto = require('crypto');
79 // // var hashes = crypto.getHashes(); )
80 // ,length: 10 //ignored and set to 13 when method === mtime
81 // ,prefix: '__' //for instance 'stamp-'
82 // //make sure to add a 'cachify' id in the head, or before any javascript
83 // //that might want to use the cachify function:
84 // ,list: [
85 // 'images/slides/tab_about_us.jpg',
86 // 'documents/Diploma_Early_Childhood_Course_Guide.pdf',
87 // ]
88 // }
89 //group the script and link blocks and concatenate all files listed in a block
90 ,concatenate: !develop_mode
91 //make sure to load the resources for custom components, the files get added
92 //to the first script and link blocks.
93 // ,extras: ['flex-slider', 'cssmenu', 'showhide']
94 //angular routes:
95 // ,routes : [
96 // ['guide', '/built/guideView.html'],
97 // ['template', '/built/guideTemplate.html', 'templateCntl']
98 // ]
99
100 //Every partial generates a string. How the partial is generated
101 //depends on its type. Each type can define more than one partial
102 //of that type by assigning an array of definitions instead of
103 //just one (object) definition to that type. These partials are
104 //identified by their id. This enables them to uses as the source in
105 //later defined templates. They don't need an id if you just want
106 //to generate a string to save to the file defined in 'out'.
107 ,partials: {
108 ids: {
109 title: '<title>Scaffold</title>'
110 // ,skewer: develop_mode ? '<script src="http://localhost:9090/skewer"></script>' : ' '
111 // ,recaptcha: '<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>'
112 // ,fragment: '<meta name="fragment" content="!">'
113
114 ,hello_world: '<h2>Hello world!</h2>'
115 }
116 ,metaBlock : {
117 id: 'meta',
118 tags: [ { charset:'utf-8' }
119 ,{ content:"IE=edge,chrome=1",
120 "http-equiv":"X-UA-Compatible"
121 }
122 ,{ content:"",
123 name:"description"
124 }
125 ,{ name: "viewport"
126 ,content: "width=device-width, initial-scale=1, maximum-scale=1"}
127 ]
128 }
129 ,linkBlock: {
130 id: 'linkBlock',
131 files: [
132 // 'bower/normalize.css/normalize.css'
133 // ,'bower/bootstrap/dist/css/bootstrap.css'
134 // ,'bower/foundation/css/foundation.css'
135 // ,'bower/jquery-ui/jquery-ui.custom.css'
136 // ,'bower/angular-ui/build/angular-ui.css'
137
138 // ,'vendor/h5bp.css'
139 // ,'vendor/checkboxes.css'
140
141 ,'main.css'
142 ]
143 ,path: 'css/'
144 }
145 //order these scriptBlocks in the order that they would be loaded by the
146 //browser, because any duplicate entries (as added by modules for
147 //instance) will be removed apart from the first. Usually you would have
148 //only one block, possibly two if you need to load modules in the head
149 //of the html document, but you can have as many as you like. Some
150 //components (like slideshow or the router for angular) need to load
151 //their own css and js files, these would be added to the last block, or
152 //te first block that has the extra:true attribute
153 ,scriptBlock: [
154 {
155 id: 'headJsBlock',
156 files: [
157 ],
158 path: 'scripts/'
159 },
160 {
161 id: 'jsBlock',
162 files: [
163 // 'bower/jquery/dist/jquery.js' //v2.1.0
164 //,'bower/bootstrap/dist/js/bootstrap.js'
165 // ,'bower/foundation/js/foundation.js'
166 // ,'bower/angular/angular.js'
167 // ,'bower/angular-ui/build/angular-ui.js'
168 // ,'bower/ui-bootstrap-tpls-0.2.0.js'
169 // ,'bower/modernizer/modernizr.js'
170 // ,'bower/jquery-ui/jquery-ui.js'
171
172 // ,'vendor/noconsole.js'
173 //,'vendor/jquery-1.6.2.min.js'
174 //,'vendor/jquery-1.8.3.min.js'
175 //,'vendor/jquery-1.9.1.min.js'
176 //,'vendor/jquery-1.9.1.min.js'
177
178 // ,'router'
179 // ,'angular.js'
180 'test.coffee',
181 //this will be substitud with the list of required modules,
182 //in the proper order, also the module enabler script will
183 //be added before the first module in every block. When this
184 //block is concatenated all module files will be
185 //denodify.wrapped. If there are scripts in a language other
186 //than javascript in the block, the files will still be
187 //concatenated, but not denodify.wrapped. Instead the
188 //resulting concatenated file will have an extension of
189 //.bundle and a first line of what is contained within the
190 //bundle. Bb-server can then extract this line, split up the
191 //bundle, recast the parts to js, denodify.wrap the module
192 //scripts, bundle it up again, cache and send it (as a
193 //proper js file).
194
195 // The giveaway is the path 'modules/[dir1/dir2/]', all
196 //required and main modules need to be in this
197 //directory. The main script needs to be in here so
198 //html-builder knows to add the required script tags here,
199 //and bb-server needs to know a requested script is a module
200 //because it needs to denodify.wrap it.
201 // ,'modules/mymodule.nm.js'
202
203 ['modules/mymodule.js']
204 ,'main.js'
205
206 ],
207 path: 'scripts/'
208 }
209 ]
210 // ,slideShow: [{ type: 'flex',
211 // id: 'flex',
212 // slides: slides
213 // }
214 // ]
215 ,menu: [
216 // { type: 'superfish',
217 // tree: mainMenuTree,
218 // id: 'superfish'
219 // },
220 ]
221 ,template: [
222 // { src: 'views/guide.html'
223 // ,tagIdPostfix: '--' //can be overridden per template
224 // ,out: 'guideView.html'
225 // ,mapping: {
226 // menu: 'html/docmenu',
227 // doc: 'markdown/doc.md'
228 // }
229 // }
230 // { src: 'views/template.html'
231 // ,tagIdPostfix: '--' //can be overridden per template
232 // ,out: 'guideTemplate.html'
233 // ,mapping: {
234 // // menu: 'html/docmenu',
235 // // doc: 'markdown/doc.md'
236 // }
237 // },
238 //Main layout
239 ,{ id: 'body'
240 ,src: 'html/body.html'
241 ,tagIdPostfix: '--' //can be overridden per template
242 ,mapping: {
243 hello_world: "hello_world"
244 }
245 }
246 ,{
247 src: 'html/basicAngularPage.html'
248 ,tagIdPostfix: '' //can be overridden per template
249 ,pathOut: ''
250 ,out: 'www/index.html' //optional, relative to root
251
252 //Maps tag ids to partial ids. Tag ids have to be
253 //postfixed with two dashes in the template. Partials
254 //with an extension will be loaded from the partials
255 //folder for this template. Markdown files will be
256 //converted to html. Partials in an array will be
257 //concatenated before inserted at the tag id element
258
259 //Make sure to have the cachify partial included in the head if
260 //you want to dynamically load resources from javascript, but
261 //want to retrieve cachified versions. Include the resources
262 //under cachify.list
263 ,mapping: {
264 head: ['title', 'meta', 'html/ieshim',//'skewer',
265 // 'firebug',
266 'headJsBlock',
267 'linkBlock'
268 ,'cachify'
269 ],
270
271 "ng:app": ['body', 'jsBlock'
272 // ,'html/google_analytics.html'
273 ]
274 }
275 }
276
277 ]
278 }
279};
280
281
282//TODO update bootstrap
283//TODO use bower or something for vendor libs