rollup-plugin-postcss
Advanced tools
Comparing version 0.2.0 to 0.3.1
{ | ||
"name": "rollup-plugin-postcss", | ||
"version": "0.2.0", | ||
"version": "0.3.1", | ||
"description": "Seamless integration between Rollup and PostCSS", | ||
"main": "index.js", | ||
"jsnext:main": "./src/index.js", | ||
"main": "dist/index.common.js", | ||
"files": [ | ||
"index.js", | ||
"src" | ||
"dist" | ||
], | ||
"scripts": { | ||
"test": "npm run build && ava test.js", | ||
"build": "rollup -c -o index.js" | ||
"test": "BABEL_ENV=test ava test/test.js && npm run lint && npm run build", | ||
"build": "bili --name index", | ||
"lint": "xo", | ||
"fix": "xo --fix" | ||
}, | ||
@@ -30,17 +30,24 @@ "repository": { | ||
"devDependencies": { | ||
"ava": "^0.15.1", | ||
"babel-preset-es2015-rollup": "^1.1.1", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"ava": "^0.19.1", | ||
"babel-plugin-transform-runtime": "^6.23.0", | ||
"babel-preset-env": "^1.3.3", | ||
"babel-preset-es2015": "^6.16.0", | ||
"babel-preset-stage-2": "^6.16.0", | ||
"babel-register": "^6.9.0", | ||
"bili": "^0.14.1", | ||
"jsdom": "^9.2.1", | ||
"postcss-modules": "^0.5.2", | ||
"postcss-modules": "^0.6.4", | ||
"postcss-nested": "^1.0.0", | ||
"require-from-string": "^1.1.0", | ||
"rollup": "^0.26.3", | ||
"rollup-plugin-babel": "^2.4.0", | ||
"sugarss": "^0.1.3" | ||
"rimraf": "^2.6.1", | ||
"rollup": "^0.41.6", | ||
"rollup-plugin-babel": "^2.6.1", | ||
"sugarss": "^0.2.0", | ||
"xo": "^0.18.1" | ||
}, | ||
"dependencies": { | ||
"concat-with-sourcemaps": "^1.0.4", | ||
"fs-promise": "^2.0.2", | ||
"postcss": "^5.0.12", | ||
"rollup-pluginutils": "^1.2.0", | ||
"rollup-pluginutils": "^2.0.1", | ||
"style-inject": "^0.1.0" | ||
@@ -50,6 +57,36 @@ }, | ||
"require": [ | ||
"./tests/helpers/set-browser-env.js", | ||
"./test/helpers/set-browser-env.js", | ||
"babel-register" | ||
], | ||
"babel": "inherit" | ||
}, | ||
"xo": { | ||
"space": 2, | ||
"envs": [ | ||
"browser" | ||
], | ||
"ignores": [ | ||
"**/dist/**", | ||
"**/output/**" | ||
] | ||
}, | ||
"babel": { | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
[ | ||
"env", | ||
{ | ||
"targets": { | ||
"node": "current" | ||
} | ||
} | ||
] | ||
], | ||
"plugins": [ | ||
"transform-runtime" | ||
] | ||
} | ||
} | ||
} | ||
} |
@@ -12,14 +12,15 @@ # rollup-plugin-postcss [![Build Status](https://img.shields.io/circleci/project/egoist/rollup-plugin-postcss/master.svg?style=flat-square)](https://circleci.com/gh/egoist/rollup-plugin-postcss/tree/master) | ||
```bash | ||
npm install rollup-plugin-postcss | ||
yarn add rollup-plugin-postcss --dev | ||
``` | ||
## Example | ||
## Examples | ||
### Basic | ||
**config** | ||
```javascript | ||
import { rollup } from 'rollup'; | ||
import postcss from 'rollup-plugin-postcss'; | ||
rollup({ | ||
export default { | ||
entry: 'main.js', | ||
@@ -32,2 +33,4 @@ plugins: [ | ||
], | ||
//sourceMap: false, // default value | ||
//extract: false, // default value | ||
extensions: ['.css', '.sss'] // default value | ||
@@ -37,3 +40,3 @@ // parser: sugarss | ||
] | ||
}).then(...) | ||
} | ||
``` | ||
@@ -44,8 +47,8 @@ | ||
```javascript | ||
import '/path/to/some_random_file.css' | ||
import '/path/to/some_random_file.css'; | ||
``` | ||
## Use with CSS modules | ||
### Use with CSS modules | ||
The [postcss-modules](postcss-modules) plugin allows you to use CSS modules in PostCSS, it requires some additional setup to use in Rollup: | ||
The [postcss-modules](https://github.com/css-modules/postcss-modules) plugin allows you to use CSS modules in PostCSS, it requires some additional setup to use in Rollup: | ||
@@ -58,3 +61,3 @@ ```js | ||
rollup({ | ||
export default { | ||
plugins: [ | ||
@@ -74,3 +77,3 @@ postcss({ | ||
] | ||
}) | ||
} | ||
``` | ||
@@ -86,6 +89,38 @@ | ||
### Extract CSS | ||
```js | ||
import postcss from 'rollup-plugin-postcss'; | ||
export default { | ||
plugins: [ | ||
postcss({ | ||
sourceMap: true, // true, "inline" or false | ||
extract : '/path/to/style.css' | ||
}) | ||
] | ||
} | ||
``` | ||
When `extract` is set to `true` the plugin will automatically generate a css file in the same place where the js is created by rollup. The css file will have the same name as the js file. | ||
### Minimize | ||
Simply use the [cssnano](http://cssnano.co/) plugin: | ||
```js | ||
import postcss from 'rollup-plugin-postcss'; | ||
import cssnano from 'cssnano'; | ||
export default { | ||
plugins: [ | ||
postcss({ | ||
plugins: [cssnano()] | ||
}) | ||
] | ||
} | ||
``` | ||
## License | ||
MIT © [EGOIST](https://github.com/egoist) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
9751
121
120
5
16
4
1
1
+ Addedfs-promise@^2.0.2
+ Addedany-promise@1.3.0(transitive)
+ Addedconcat-with-sourcemaps@1.1.0(transitive)
+ Addedestree-walker@0.6.1(transitive)
+ Addedfs-extra@2.1.2(transitive)
+ Addedfs-promise@2.0.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@2.4.0(transitive)
+ Addedmz@2.7.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedrollup-pluginutils@2.8.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedthenify@3.3.1(transitive)
+ Addedthenify-all@1.6.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedestree-walker@0.2.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedrollup-pluginutils@1.5.2(transitive)
Updatedrollup-pluginutils@^2.0.1