Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
Latest commit
43 lines (37 loc) · 971 Bytes
/
Copy pathindex.js
File metadata and controls
43 lines (37 loc) · 971 Bytes
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
constpostcss=require('postcss')
constcssnext=require('postcss-preset-env')
constimports=require('postcss-import')
constxtend=require('xtend')
module.exports=transform
functiontransform(filename,source,options,done){
options=xtend(options||{})
constsourcemap=options.sourcemap
deleteoptions.sourcemap
constprocessor=postcss([
imports(),
cssnext(options)
])
constpoptions=xtend({
map: sourcemap===false ? false : {inline: true},
from: filename,
messages: {
browser: true,
console: false
}
},options||{})
processor.process(source,poptions).then(function(result){
// Collect imported files for watchify
constfiles=[filename]
result.messages.forEach(function(msg){
if(msg.type==='dependency'){
files.push(msg.file)
}
})
done(null,{
css: result.css,
files: files
})
},function(err){
done(err)
})
}