Skip to content

Commit aa85696

Browse files
author
tknipfer
committed
add postcss and autoprefixer
1 parent c44a80d commit aa85696

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@
5050
"rollup-plugin-node-resolve": "^3.0.0",
5151
"rollup-plugin-nodent": "^0.1.3",
5252
"rollup-plugin-post-replace": "^1.0.0",
53+
"rollup-plugin-postcss": "^0.5.5",
5354
"rollup-plugin-preserve-shebang": "^0.1.3",
5455
"rollup-plugin-sizes": "^0.4.2",
5556
"rollup-plugin-uglify": "^2.0.1",
5657
"yargs": "^10.0.3"
5758
},
5859
"devDependencies": {
60+
"autoprefixer": "^7.2.3",
5961
"babel-cli": "^6.26.0",
6062
"babel-preset-env": "^1.6.1",
6163
"eslint": "^4.13.0",

src/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,27 @@ import chalk from 'chalk';
44
import { map, series } from 'asyncro';
55
import promisify from 'es6-promisify';
66
import glob from 'glob';
7+
import autoprefixer from 'autoprefixer';
78
import { rollup, watch } from 'rollup';
89
import nodent from 'rollup-plugin-nodent';
910
import commonjs from 'rollup-plugin-commonjs';
1011
import nodeResolve from 'rollup-plugin-node-resolve';
1112
import buble from 'rollup-plugin-buble';
1213
import uglify from 'rollup-plugin-uglify';
14+
import postcss from 'rollup-plugin-postcss';
1315
// import replace from 'rollup-plugin-post-replace';
1416
import es3 from 'rollup-plugin-es3';
1517
import gzipSize from 'gzip-size';
1618
import prettyBytes from 'pretty-bytes';
1719
import shebangPlugin from 'rollup-plugin-preserve-shebang';
1820
import flow from 'rollup-plugin-flow';
21+
import camelCase from 'camelcase';
1922

2023
const readFile = promisify(fs.readFile);
2124
const stat = promisify(fs.stat);
2225
const isDir = name => stat(name).then( stats => stats.isDirectory() ).catch( () => false );
2326
const isFile = name => stat(name).then( stats => stats.isFile() ).catch( () => false );
24-
const safeVariableName = name => name.replace(/(?:^[^a-z$_]|([^a-z0-9_$]+))/g, '_');
27+
const safeVariableName = name => camelCase(name.toLowerCase().replace(/((^[^a-zA-Z]+)|[^\w.-])|([^a-zA-Z0-9]+$)/g, ''));
2528

2629
const FORMATS = ['es', 'cjs', 'umd'];
2730

@@ -171,6 +174,12 @@ function createConfig(options, entry, format) {
171174
input: entry,
172175
external,
173176
plugins: [
177+
postcss({
178+
plugins: [
179+
autoprefixer()
180+
],
181+
extract: true
182+
}),
174183
flow({ all: true }),
175184
nodent({
176185
exclude: 'node_modules/**',

0 commit comments

Comments
 (0)