GithubHelp home page GithubHelp logo

wagenet / postcss-sass Goto Github PK

View Code? Open in Web Editor NEW

This project forked from csstools/postcss-sass

0.0 0.0 0.0 28 KB

Use Sass as a PostCSS plugin

License: Creative Commons Zero v1.0 Universal

JavaScript 78.38% HTML 18.66% SCSS 2.96%

postcss-sass's Introduction

PostCSS Sass PostCSS Logo

NPM Version Linux Build Status Windows Build Status Support Chat

PostCSS Sass lets you use Sass as a PostCSS plugin.

$font-stack:    Helvetica, sans-serif;
$primary-color: #333;

:root {
  color: $primary-color;
  font: 100% $font-stack;
}

/* becomes */

:root {
  color: #333;
  font: 100% Helvetica, sans-serif;
}

PostCSS Sass uses dart-sass, letting you safely run transforms before and after Sass, watching for changes to Sass imports, and preserving source maps.

Usage

Add PostCSS Sass to your build tool:

npm install postcss @csstools/postcss-sass --save-dev

Node

Use PostCSS Sass to process your CSS:

require('@csstools/postcss-sass').process(YOUR_CSS);

PostCSS

Use PostCSS Sass as a plugin:

postcss([
  require('@csstools/postcss-sass')(/* node-sass options */)
]).process(YOUR_CSS);

The standard CSS parser included with PostCSS may not be able to parse SCSS specific features like inline comments. To accurately parse SCSS, use the SCSS Parser.

npm install postcss-scss --save-dev
const postcss = require('postcss');
const postcssSass = require('@csstools/postcss-sass');

postcss([
  postcssSass(/* pluginOptions */)
]).process(YOUR_CSS, {
  syntax: 'postcss-scss'
});

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Use PostCSS Sass in your Gulpfile:

var postcss = require('gulp-postcss');

gulp.task('css', function () {
  return gulp.src('./src/*.css').pipe(
    postcss([
      require('@csstools/postcss-sass')(/* node-sass options */)
    ])
  ).pipe(
    gulp.dest('.')
  );
});

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Use PostCSS Sass in your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
  postcss: {
    options: {
      use: [
        require('@csstools/postcss-sass')(/* node-sass options */)
      ]
    },
    dist: {
      src: '*.css'
    }
  }
});

Options

PostCSS Sass options are directly forwarded to dart-sass options.

postcss-sass's People

Contributors

jonathantneal avatar matthieusieben avatar joycebabu avatar okikio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.