forked from twbs/bootstrap-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manifest.js
87 lines (54 loc) · 1.7 KB
/
manifest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
'use strict';
// Build script from https://github.com/nodeca/mincer/tree/master/examples
//
// Require module
//
var Mincer = require('mincer');
//
// Get Mincer environment
//
//
// Configure Mincers logger, by default, all
// messages are going to the middle of nowhere
//
Mincer.logger.use(console);
//
// Create and export environment
//
var environment = new Mincer.Environment(process.cwd());
//
// Configure environment load paths (where to find ssets)
//
// Include bootstrap scss load path
var bootstrapPath = '../../';
environment.appendPath(bootstrapPath + 'assets/stylesheets');
// Include fonts load path
environment.appendPath(bootstrapPath + 'assets/fonts');
// Include dir with assets, root just for test
environment.appendPath('./');
//
// Define environment essential *_path helper that will be available in the
// processed assets. See `assets/stylesheets/app.css.ejs` for example.
//
environment.ContextClass.defineAssetPath(function (pathname, options) {
var asset = this.environment.findAsset(pathname, options);
if (!asset) {
throw new Error("File " + pathname + " not found");
}
return '/assets/' + asset.digestPath;
});
//
// Create and compile Manifest
//
var manifest_path = process.argv[2] || __dirname + '/assets';
var manifest = new Mincer.Manifest(environment, manifest_path);
manifest.compile(['application.css'], function (err, assetsData) {
if (err) {
console.error("Failed compile assets: " + (err.message || err.toString()));
process.exit(128);
}
console.info('\n\nAssets were successfully compiled.\n' +
'Manifest data (a proper JSON) was written to:\n' +
manifest.path + '\n\n');
console.dir(assetsData);
});