Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicbell/postscss
node-sass + PostCss = PostScss
https://github.com/nicbell/postscss
node-sass postcss
Last synced: about 1 month 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 (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-01-03T20:55:02.000Z (11 months ago)
- Last Synced: 2024-10-02T03:23:14.170Z (about 1 month ago)
- Topics: node-sass, postcss
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PostScss [![NPM](https://img.shields.io/npm/v/postscss?style=flat&logo=npm)](https://www.npmjs.com/package/postscss) ![Downloads](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fnicbell%2Fnpm-statistics%2Fmaster%2Fpackages%2Fpostscss.json&style=flat&logo=null&label=downloads&color=violet&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fpostscss)
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
});
```