All Projects → dougludlow → plugin-sass

dougludlow / plugin-sass

Licence: MIT license
SystemJS SASS loader plugin

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to plugin-sass

systemjs-riot
jspm/systemjs plugin to load RiotJS tags and inline them in the bundle
Stars: ✭ 18 (-66.04%)
Mutual labels:  systemjs, jspm
systemjs-tools
(dev)tools for working with SystemJS
Stars: ✭ 41 (-22.64%)
Mutual labels:  systemjs, jspm
Kotsu
✨ Clean, opinionated foundation for new projects — to boldly go where no man has gone before
Stars: ✭ 48 (-9.43%)
Mutual labels:  jspm
jspm-mithril
Mithril.js boilerplate with hot reloading modules
Stars: ✭ 14 (-73.58%)
Mutual labels:  jspm
cbuild
Use SystemJS with npm instead of jspm
Stars: ✭ 25 (-52.83%)
Mutual labels:  systemjs
requirex
A different kind of module loader 📦🦖
Stars: ✭ 20 (-62.26%)
Mutual labels:  systemjs
jspm-ember-playground
Basic Ember app which uses JSPM as a package manager
Stars: ✭ 15 (-71.7%)
Mutual labels:  jspm
babel-plugin-rewire-exports
Babel plugin for stubbing [ES6, ES2015] module exports
Stars: ✭ 62 (+16.98%)
Mutual labels:  systemjs
gulp-jspm-build
Gulp plugin for jspm.
Stars: ✭ 22 (-58.49%)
Mutual labels:  jspm
ASPNETcoreAngularJWT
Angular in ASP.NET Core with JWT solution by systemjs
Stars: ✭ 48 (-9.43%)
Mutual labels:  systemjs
angular-gulp-starter
Simple dev/prod build for Angular (2+) using gulp, systemjs, rollup, ngc (AOT), scss, Visual Studio
Stars: ✭ 18 (-66.04%)
Mutual labels:  systemjs
angular2-esri-playground
Angular 2 & Esri 4
Stars: ✭ 30 (-43.4%)
Mutual labels:  systemjs
aurelia-datatable
A 100% aurelia based data table component.
Stars: ✭ 32 (-39.62%)
Mutual labels:  jspm
generator-sf
Yeoman generator that scaffolds out a Symfony PHP app including Browsersync, various CSS preprocessors, jspm, webpack, browserify and Service Worker
Stars: ✭ 14 (-73.58%)
Mutual labels:  jspm

JSPM SASS/SCSS Plugin

Build Status

SystemJS SASS loader plugin. Can easily be installed with jspm package manager.

$ jspm install sass --dev

Recommended plugin usage configuration is:

SystemJS.config({
  meta: {
    "*.scss": { "loader": "sass" },
    "*.sass": { "loader": "sass" }
  }
});

To apply your SASS styles to your current page asynchronously:

System.import('./style.scss');

or synchronously

import './style.scss';

You can also use the older syntax , known as the indented syntax (or sometimes just "Sass")

System.import('./style.sass');

Note: if you use a different transpiler as Babel, like TypeScript, the plugin does not work by default. This is because this plugin and jspm / SystemJS is based on ES2015 syntax. All code is written with the Babel transpiler so you have to use the transpiler first before you can use the plugin. Please have a look at issue #25 for a solution.

Features

  • sass, scss
  • @import supported
  • "jspm:" prefix to refer jspm package files
  • url rewrite and asset copier
  • autoprefixer with custom configuration
  • minified and non minified build
  • bundle css separately or inline into build

Importing from jspm

You can import scss files from jspm packages from within scss files using the jspm: prefix. For example, if you have jspm installed twbs/bootstrap-sass:

@import 'jspm:bootstrap-sass/assets/stylesheets/bootstrap';

Legacy options

Some legacy plugin-css options are supported:

System.config({
  separateCSS: false, // change to true to separate css from js bundle
  buildCSS: true,     // change to false to not build css and process it manually
});
  • separateCSS: true|false, default to false, set to true to separate css from js bundle, works well if plugin-css is not used, otherwise both plugins will try to save css in the same file and one will overwrite results of another one.
  • buildCSS: true|false, defalt to true, set to to not build css and process it manually.

Configuring the plugin

You can configure some options how the plugin should behave. Just add a new sassPluginOptions config object to your config.js.

System.config({
  sassPluginOptions: {
  }
})

Autoprefixer

To enable autoprefixer

sassPluginOptions: {
  "autoprefixer": true
}

or

sassPluginOptions: {
  "autoprefixer": {
    "browsers": ["last 2 versions"]
  }
}

SASS options

To add SASS options

sassPluginOptions: {
  "sassOptions": {

  }
}

URL rewriter and asset copier

Options rewriteUrl enables rewrite scss URLs to use correct path from SystemJS base URL.

Option copyAssets enables copy CSS-related assets into destination folder.

jspm build app dist/app.js --format global --minify --skip-source-maps
sassPluginOptions: {
  "copyAssets": true,
  "rewriteUrl": true
}

Testing the plugin

$ npm install
...
$ jspm install

To run unit tests just do a

$ npm run test

To test that everything works in your browser you can test runtime compilation

$ npm run test:runtime

or bundling

$ npm run test:bundle

or self-executing bundle

$ npm run test:bundleSfx
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].