Last active
August 6, 2019 20:00
-
-
Save elenakondrateva/0f24216d24d797b91828d3744ec35659 to your computer and use it in GitHub Desktop.
Magento 2 Post CSS Autoprefixer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Project", | |
"author": "Vendor", | |
"description": "Node modules dependencies for local development", | |
"version": "2.0.0", | |
"license": "(OSL-3.0 OR AFL-3.0)", | |
"repository": { | |
"type": "git", | |
"url": "https://github.com/magento/magento2.git" | |
}, | |
"homepage": "http://magento.com/", | |
"devDependencies": { | |
"autoprefixer": "^7.1.1", | |
"glob": "^5.0.14", | |
"grunt": "^0.4.5", | |
"grunt-banner": "^0.4.0", | |
"grunt-contrib-clean": "^0.6.0", | |
"grunt-contrib-connect": "^0.9.0", | |
"grunt-contrib-cssmin": "^0.10.0", | |
"grunt-contrib-imagemin": "^0.9.2", | |
"grunt-contrib-jasmine": "^0.8.1", | |
"grunt-contrib-less": "^0.12.0", | |
"grunt-contrib-watch": "^0.6.1", | |
"grunt-eslint": "17.3.1", | |
"grunt-exec": "^0.4.6", | |
"grunt-jscs": "2.2.0", | |
"grunt-postcss": "^0.8.0", | |
"grunt-replace": "^0.9.2", | |
"grunt-styledocco": "^0.1.4", | |
"grunt-template-jasmine-requirejs": "^0.2.3", | |
"grunt-text-replace": "^0.4.0", | |
"imagemin-svgo": "^4.0.1", | |
"load-grunt-config": "^0.16.0", | |
"morgan": "^1.5.0", | |
"node-minify": "^1.0.1", | |
"path": "^0.11.14", | |
"serve-static": "^1.7.1", | |
"strip-json-comments": "^1.0.2", | |
"time-grunt": "^1.0.0", | |
"underscore": "^1.7.0" | |
}, | |
"engines": { | |
"node": ">=0.10.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* PostCSS autoprefixer initialisation | |
* | |
* Docs: https://github.com/postcss/autoprefixer | |
* Config: dev/tools/grunt/configs/postcss.json | |
* Usage: grunt autoprefixer:themename [--verbose] [--debug] | |
* To do: load src from themes.js | |
* | |
* @param grunt | |
*/ | |
module.exports = function(grunt) { | |
grunt.loadNpmTasks('grunt-postcss'); | |
grunt.registerTask('autoprefixer', function (target) { | |
var currentTarget = target || 'dist'; | |
/*** configuration tweaks ***/ | |
var config = grunt.config.get('postcss'); | |
// set 'processors' options (not possible to set function in json config) | |
config['options'].processors = [require('autoprefixer')({browsers: ['last 2 versions']})]; | |
// apply theme source and destination dynamically | |
if (target) { | |
config[target] = { | |
src: ['pub/static/frontend/*/'+target+'/*/css/*.css'] | |
}; | |
} | |
grunt.config.set('postcss', config); | |
grunt.option('force', true); | |
grunt.task.run('postcss:'+currentTarget); | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"options": { | |
"map": true | |
}, | |
"dist": { | |
"src": ["pub/static/frontend/*/*/*/css/*.css"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment