diff options
Diffstat (limited to 'tasks/cssflip.js')
-rw-r--r-- | tasks/cssflip.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tasks/cssflip.js b/tasks/cssflip.js new file mode 100644 index 0000000..71ffd31 --- /dev/null +++ b/tasks/cssflip.js @@ -0,0 +1,34 @@ +/* + * grunt-css-flip + * https://github.com/twbs/grunt-css-flip + * + * Copyright (c) 2014 Chris Rebert + * Licensed under the MIT License. + */ + +'use strict'; + +var flip = require('css-flip'); + + +module.exports = function (grunt) { + grunt.registerMultiTask('cssflip', 'Grunt plugin for Twitter\'s css-flip', function () { + var options = this.options({}); + + this.files.forEach(function (f) { + var originalCss = grunt.file.read(f.src); + + var flippedCss = null; + try { + flippedCss = flip(originalCss, options); + } + catch (err) { + grunt.fail.warn(err); + } + + grunt.file.write(f.dest, flippedCss); + + grunt.log.writeln('File "' + f.dest.cyan + '" created.'); + }); + }); +}; |