2.0.1 • Published 10 years ago

sass-resolve v2.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

sass-resolve build status

Resolves all sass files in current project and all dependencies to create on sourcemapped css file fromt them.

var sassResolve =  require('sass-resolve');
var path        =  require('path');

var projectPath =  path.join(__dirname, 'fixtures');

sassResolve(
    projectPath    
  , { inlineSourceMap: false }
  , function (err, res) {
      if (err) return console.error(err);
      console.log(res.css);
      console.log(res.map);
    }
);

Installation

npm install sass-resolve

Note

sass-resolve >= v2 generates css using libsass. This eases deployment (npm install is all you need) and compiles much faster (20x faster on our project) than Ruby sass.

If you run into problems and need to use Ruby sass, please npm install sass-resolve@1 and review the relevant docs (the API has changed somewhat).

API

package.json

In order for resolve-sass to be able to find your .scss files you need to specify an .scss entry file via the main.scss field in the package.json of each project that has .scss files.

The entry .scss file should specify an @import for each .scss file you want to include.

Example

// package.json
{
  [..]
  "main.scss": "sass/index.scss",
  [..]
}
// sass/index.scss
@import "foo";
@import "bar";

Please investigate these fixtures for more information.

To get a better understanding of what options to set, please consult these tests.

generated with docme

Examples

debug: true, inlineSourceMap: false, mapFileName: 'my.css.map'

Will generate source maps and inline the sources of all original files.

These source map is returned as res.map which you'll have to serve as /my.css.map.

debug: true, inlineSourceMap: true

Will generate source maps and instead of referring to a separate res.map. all source map data is inlined at the bottom of the css. Therefore you don't have to serve the source map, but keep in mind that now it adds to the size of the css loaded, so only use this option in development.

License

MIT

2.0.1

10 years ago

2.0.0

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.4.0

10 years ago

0.3.1

10 years ago

0.3.0

11 years ago

0.2.0

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago