https://github.com/nicbell/postscss
node-sass + PostCss = PostScss
https://github.com/nicbell/postscss
node-sass postcss
Last synced: 12 months ago
JSON representation
node-sass + PostCss = PostScss
- Host: GitHub
- URL: https://github.com/nicbell/postscss
- Owner: nicbell
- License: isc
- Created: 2015-10-02T15:04:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-01-03T20:55:02.000Z (over 2 years ago)
- Last Synced: 2025-03-28T08:41:30.989Z (about 1 year ago)
- Topics: node-sass, postcss
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PostScss [](https://www.npmjs.com/package/postscss) 

node-sass + PostCss = PostScss.
PostScss compiles SASS into CSS then runs [PostCSS](https://github.com/postcss/postcss) plugins. It also supports importing Eyeglass modules.
## Install
```sh
npm i postscss
```
## Usage
```js
var postscss = require('postscss');
// Single build
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
});
// Disabling source maps
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css',
sourceMapDisabled: true
});
// Multiple builds
postscss([postcss plugins]).processMany([{
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
}, {
from: 'xxx/src/scss/xxx2.scss',
to: 'xxx/dist/css/xxx2.css'
}]);
```
## Promises
```js
var postscss = require('postscss');
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
})
.then(function() {
console.log('All done.');
})
.catch(function(error) {
// Error handling.
});
```
## PostCss plugins example
```js
var postscss = require('postscss');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
postscss([autoprefixer(['> 5%', 'last 2 versions', 'ie > 7']), cssnano()]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
});
```
## Grunt example
```js
grunt.registerTask('compileSCSS', 'Task description.', function () {
var done = this.async();
var postscss = require('postscss');
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css'
})
.then(done);
});
```
## SASS importer
```js
var postscss = require('postscss');
var npmsass = require('npm-sass');
postscss([postcss plugins]).process({
from: 'xxx/src/scss/xxx.scss',
to: 'xxx/dist/css/xxx.css',
importer: npmsass.importer
});
```