grunt-autoprefixer
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "grunt-autoprefixer", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Parse CSS and add vendor-prefixed CSS properties using the Can I Use database. Based on Autoprefixer.", | ||
@@ -30,4 +30,5 @@ "author": { | ||
"autoprefixer-core": "^5.1.7", | ||
"chalk": "~1.0.0", | ||
"diff": "~1.3.0", | ||
"chalk": "~1.0.0" | ||
"postcss": "^4.1.11" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
@@ -0,1 +1,5 @@ | ||
# Deprecation notice | ||
### This project has been deprecated in favour of [grunt-postcss](https://github.com/nDmitry/grunt-postcss). | ||
# grunt-autoprefixer | ||
@@ -118,66 +122,2 @@ [![Build Status](https://travis-ci.org/nDmitry/grunt-autoprefixer.png?branch=master)](https://travis-ci.org/nDmitry/grunt-autoprefixer) | ||
### Usage Examples | ||
```js | ||
grunt.initConfig({ | ||
autoprefixer: { | ||
options: { | ||
// Task-specific options go here. | ||
}, | ||
// prefix the specified file | ||
single_file: { | ||
options: { | ||
// Target-specific options go here. | ||
}, | ||
src: 'src/css/file.css', | ||
dest: 'dest/css/file.css' | ||
}, | ||
// prefix all files | ||
multiple_files: [{ | ||
expand: true, | ||
flatten: true, | ||
src: 'src/css/*.css', // -> src/css/file1.css, src/css/file2.css | ||
dest: 'dest/css/' // -> dest/css/file1.css, dest/css/file2.css | ||
}], | ||
// if you have specified only the `src` param, the destination will be set automatically, | ||
// so source files will be overwritten | ||
no_dest: { | ||
src: 'dest/css/file.css' // globbing is also possible here | ||
}, | ||
diff: { | ||
options: { | ||
diff: true | ||
}, | ||
src: 'src/css/file.css', | ||
dest: 'dest/css/file.css' // -> dest/css/file.css, dest/css/file.css.patch | ||
}, | ||
sourcemap: { | ||
options: { | ||
map: true | ||
}, | ||
src: 'src/css/file.css', | ||
dest: 'dest/css/file.css' // -> dest/css/file.css, sourcemap is inlined | ||
}, | ||
sourcemap_separate: { | ||
options: { | ||
map: { | ||
inline: false | ||
} | ||
}, | ||
src: 'src/css/file.css', | ||
dest: 'dest/css/file.css' // -> dest/css/file.css, dest/css/file.css.map | ||
}, | ||
} | ||
}); | ||
``` | ||
Check out project's [Gruntfile.js](https://github.com/nDmitry/grunt-autoprefixer/blob/master/Gruntfile.js) for more examples. | ||
@@ -184,0 +124,0 @@ |
'use strict'; | ||
var path = require('path'); | ||
var postcss = require('postcss'); | ||
var autoprefixer = require('autoprefixer-core'); | ||
@@ -71,4 +72,12 @@ var diff = require('diff'); | ||
prefixer = autoprefixer({browsers: options.browsers, cascade: options.cascade, remove: options.remove}); | ||
prefixer = postcss([autoprefixer({ | ||
browsers: options.browsers, | ||
cascade: options.cascade, | ||
remove: options.remove | ||
})]); | ||
var done = this.async(); | ||
var finished = 0; | ||
var processed = this.files.length; | ||
this.files.forEach(function(f) { | ||
@@ -79,14 +88,17 @@ if (!f.src.length) { | ||
try { | ||
f.src.forEach(function(filepath) { | ||
var dest = f.dest || filepath; | ||
var input = grunt.file.read(filepath); | ||
var output = prefix(input, filepath, dest); | ||
f.src.forEach(function(filepath) { | ||
var dest = f.dest || filepath; | ||
var input = grunt.file.read(filepath); | ||
grunt.file.write(dest, output.css); | ||
prefix(input, filepath, dest).then(function(result) { | ||
result.warnings().forEach(function (msg) { | ||
grunt.log.error(msg.toString()); | ||
}); | ||
grunt.file.write(dest, result.css); | ||
log('File ' + chalk.cyan(dest) + ' created.'); | ||
tally.sheets++; | ||
if (output.map) { | ||
grunt.file.write(dest + '.map', output.map.toString()); | ||
if (result.map) { | ||
grunt.file.write(dest + '.map', result.map.toString()); | ||
log('File ' + chalk.cyan(dest + '.map') + ' created (source map).'); | ||
@@ -99,10 +111,20 @@ tally.maps++; | ||
grunt.file.write(diffPath, diff.createPatch(dest, input, output.css)); | ||
grunt.file.write(diffPath, diff.createPatch(dest, input, result.css)); | ||
log('File ' + chalk.cyan(diffPath) + ' created (diff).'); | ||
tally.diffs++; | ||
} | ||
finished += 1; | ||
if (finished === processed) { | ||
done(); | ||
} | ||
}).catch(function (error) { | ||
if (error.name === 'CssSyntaxError') { | ||
grunt.fatal(error.message + error.showSourceCode()); | ||
} else { | ||
grunt.fatal(error); | ||
} | ||
}); | ||
} catch (e) { | ||
grunt.fail.fatal(e); | ||
} | ||
}); | ||
}); | ||
@@ -109,0 +131,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118
13708
5
132
+ Addedpostcss@^4.1.11