-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
44 lines (35 loc) · 800 Bytes
/
index.js
File metadata and controls
44 lines (35 loc) · 800 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
44
/**
* Module dependencies
*/
var autoprefixer = require('autoprefixer-core');
var through = require('through');
var assert = require('assert');
/**
* Expose `transform()`.
*/
module.exports = transform;
/**
* Text-transform `autoPrefixer()`.
*
* @param {Object} opts
* @return {Function}
* @api public
*/
function transform(opts) {
var src = '';
var buffer = [];
var opts = opts || {};
var prefixes = autoprefixer({browsers: opts.browsers});
return function autoprefix(file) {
if (/\.css$/.test(file)) return through();
return through(write, flush);
function write(data) {
buffer.push(data);
}
function flush() {
var source = buffer.join('');
var nw = prefixes.process(source, {from: src, to: src}).css;
return nw;
}
}
}