From aa85696150db5be66361a0afd825a0d7e3816a78 Mon Sep 17 00:00:00 2001 From: tknipfer Date: Mon, 18 Dec 2017 07:36:07 -0500 Subject: [PATCH 1/2] add postcss and autoprefixer --- package.json | 2 ++ src/index.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index a8b6df0..b47a829 100644 --- a/package.json +++ b/package.json @@ -50,12 +50,14 @@ "rollup-plugin-node-resolve": "^3.0.0", "rollup-plugin-nodent": "^0.1.3", "rollup-plugin-post-replace": "^1.0.0", + "rollup-plugin-postcss": "^0.5.5", "rollup-plugin-preserve-shebang": "^0.1.3", "rollup-plugin-sizes": "^0.4.2", "rollup-plugin-uglify": "^2.0.1", "yargs": "^10.0.3" }, "devDependencies": { + "autoprefixer": "^7.2.3", "babel-cli": "^6.26.0", "babel-preset-env": "^1.6.1", "eslint": "^4.13.0", diff --git a/src/index.js b/src/index.js index df7d2af..9ff2373 100644 --- a/src/index.js +++ b/src/index.js @@ -4,24 +4,27 @@ import chalk from 'chalk'; import { map, series } from 'asyncro'; import promisify from 'es6-promisify'; import glob from 'glob'; +import autoprefixer from 'autoprefixer'; import { rollup, watch } from 'rollup'; import nodent from 'rollup-plugin-nodent'; import commonjs from 'rollup-plugin-commonjs'; import nodeResolve from 'rollup-plugin-node-resolve'; import buble from 'rollup-plugin-buble'; import uglify from 'rollup-plugin-uglify'; +import postcss from 'rollup-plugin-postcss'; // import replace from 'rollup-plugin-post-replace'; import es3 from 'rollup-plugin-es3'; import gzipSize from 'gzip-size'; import prettyBytes from 'pretty-bytes'; import shebangPlugin from 'rollup-plugin-preserve-shebang'; import flow from 'rollup-plugin-flow'; +import camelCase from 'camelcase'; const readFile = promisify(fs.readFile); const stat = promisify(fs.stat); const isDir = name => stat(name).then( stats => stats.isDirectory() ).catch( () => false ); const isFile = name => stat(name).then( stats => stats.isFile() ).catch( () => false ); -const safeVariableName = name => name.replace(/(?:^[^a-z$_]|([^a-z0-9_$]+))/g, '_'); +const safeVariableName = name => camelCase(name.toLowerCase().replace(/((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g, '')); const FORMATS = ['es', 'cjs', 'umd']; @@ -171,6 +174,12 @@ function createConfig(options, entry, format) { input: entry, external, plugins: [ + postcss({ + plugins: [ + autoprefixer() + ], + extract: true + }), flow({ all: true }), nodent({ exclude: 'node_modules/**', From 0e8594416faa8753db0957f7c0f419101a38b6d4 Mon Sep 17 00:00:00 2001 From: knipferrc Date: Mon, 18 Dec 2017 07:39:17 -0500 Subject: [PATCH 2/2] fix package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6731427..19012d2 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "dependencies": { "acorn-jsx": "4.1.0", "asyncro": "^2.0.1", + "autoprefixer": "^7.2.3", "babel-polyfill": "^6.26.0", "camelcase": "^4.1.0", "chalk": "^2.3.0", @@ -58,7 +59,6 @@ "yargs": "^10.0.3" }, "devDependencies": { - "autoprefixer": "^7.2.3", "babel-cli": "^6.26.0", "babel-preset-env": "^1.6.1", "eslint": "^4.13.0",