From 51d5e0cac378f99fc5ca52a58da9ed37ef7b83ba Mon Sep 17 00:00:00 2001 From: jpsc Date: Mon, 18 Jul 2016 15:43:36 +0200 Subject: [PATCH] feat(postcss-task): add browserify config; change custom variables module --- package.json | 5 +++-- scripts/postcss.js | 24 ------------------------ 2 files changed, 3 insertions(+), 26 deletions(-) delete mode 100644 scripts/postcss.js diff --git a/package.json b/package.json index a5a2f47..fb17428 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "prebuild": "rimraf dist/ && mkdirp dist/", "build": "npm-run-all --parallel build:css build:js", - "build:css": "node scripts/postcss.js", + "build:css": "postcss -u postcss-import -u postcss-custom-properties -u cssnano -u autoprefixer --autoprefixer.browsers 'last 1 versions, ie >= 9' -o dist/demo-viewer.css src/index.css", "build:js": "npm run build:tags && npm run build:concat", "build:tags": "riot --type none --ext tag.html src/modules/ dist/tags.js", "build:concat": "concat-cli --files node_modules/riot/riot.min.js dist/tags.js src/index.js --output dist/demo-viewer.js", @@ -39,8 +39,9 @@ "mkdirp": "0.5.1", "ncp": "2.0.0", "npm-run-all": "1.5.1", - "postcss": "5.0.21", + "postcss-cli": "2.5.2", "postcss-css-variables": "0.5.1", + "postcss-custom-properties": "5.0.1", "postcss-import": "8.1.1", "rimraf": "2.5.2", "riot": "2.3.15" diff --git a/scripts/postcss.js b/scripts/postcss.js deleted file mode 100644 index 5656385..0000000 --- a/scripts/postcss.js +++ /dev/null @@ -1,24 +0,0 @@ -const fs = require('fs'); -const postcss = require('postcss'); - -const inputFilename = 'src/index.css'; -const outputDir = 'dist/'; -const outputFilename = 'dist/demo-viewer.css'; - -postcss([ - require('postcss-import'), // combine imports into one file - require('postcss-css-variables'), // css variables - require('autoprefixer'), // vendor prefix for older browsers - require('cssnano') // minify css - ]) - .process(fs.readFileSync(inputFilename), { - from: inputFilename, - to: outputFilename.substr(outputDir.length), // file path relative to output dir - map: { inline: false } - }) - .then(function (result) { - fs.writeFileSync(outputFilename, result.css); - if (result.map) { - fs.writeFileSync(`${outputFilename}.map`, result.map); - } - }); \ No newline at end of file