forked from RubyLouvre/avalon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildIE6Sauce.js
46 lines (35 loc) · 1.13 KB
/
buildIE6Sauce.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
var rollup = require('rollup');
var fs = require('fs');
var less = require('semicolon-less')
//var babel = require('rollup-plugin-babel');
var babel = require("babel-core");
var transform = require('es3ify').transform;
// used to track the cache for subsequent bundles
var cache;
module.exports = rollup.rollup({
entry: 'test/spec.js',
cache: cache,
plugins: [
]
}).then(function(bundle) {
// Generate bundle + sourcemap
var result = bundle.generate({
format: 'umd',
moduleName: 'avalon'
});
// Cache our bundle for later use (optional)
cache = bundle;
result.code = result.code.replace(
/Object\.defineProperty\(exports,\s*'__esModule',\s*\{\s*value:\s*true\s*\}\);/,
"exports.__esModule = true").
// replace(/'use strict';?/, '').
replace(/avalon\$1/g, 'avalon')
result = babel.transform(result.code, {
presets: ['avalon'],
compact: false
})
var code = transform(result.code).replace(/\}\)\(undefined,/, '})(this,')
fs.writeFileSync('./dist/avalon.sauce.js', less(code));
}).catch(function(e) {
console.log('error', e)
})