Permalink
Browse files

rewrite task and bump node-sass

  • Loading branch information...
1 parent 98d808f commit f18b613815147c6c6dca8ceb5ba52b84faa7c0a0 @sindresorhus committed Jun 5, 2014
Showing with 89 additions and 223 deletions.
  1. +1 −1 .gitattributes
  2. +1 −4 .jshintrc
  3. +2 −19 Gruntfile.js
  4. +21 −0 license
  5. +22 −23 package.json
  6. +29 −119 readme.md
  7. +13 −39 tasks/sass.js
  8. +0 −18 test/test.js
View
@@ -1 +1 @@
-* text eol=lf
+* text=auto
View
@@ -1,6 +1,5 @@
{
"node": true,
- "browser": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
@@ -13,7 +12,5 @@
"quotmark": "single",
"undef": true,
"unused": "vars",
- "strict": true,
- "trailing": true,
- "smarttabs": true
+ "strict": true
}
View
@@ -9,7 +9,7 @@ module.exports = function (grunt) {
},
includePaths: {
options: {
- includePaths: ['./test/fixtures']
+ includePaths: ['test/fixtures']
},
files: {
'test/tmp/include-paths.css': 'test/fixtures/include-paths.scss'
@@ -23,14 +23,6 @@ module.exports = function (grunt) {
'test/tmp/image-path.css': 'test/fixtures/image-path.scss'
}
},
- sourceComments: {
- options: {
- sourceComments: 'normal'
- },
- files: {
- 'test/tmp/source-comments.css': 'test/fixtures/test.scss'
- }
- },
ignorePartials: {
cwd: 'test/fixtures/partials',
src: '*.scss',
@@ -40,21 +32,12 @@ module.exports = function (grunt) {
},
sourceMap: {
options: {
- sourceComments: 'map',
sourceMap: 'source-map.css.map'
},
files: {
'test/tmp/source-map.css': 'test/fixtures/test.scss'
}
},
- sourceMapBySourceComment: {
- options: {
- sourceComments: 'map'
- },
- files: {
- 'test/tmp/source-map-sc.css': 'test/fixtures/test.scss'
- }
- },
sourceMapSimple: {
options: {
sourceMap: true
@@ -68,7 +51,7 @@ module.exports = function (grunt) {
tasks: ['test/test.js']
},
clean: {
- test: ['test/tmp']
+ test: ['test/tmp/**']
}
});
View
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -1,7 +1,23 @@
{
"name": "grunt-sass",
"version": "0.12.1",
- "description": "Compile SCSS to CSS using node-sass",
+ "description": "Compile Sass to CSS using node-sass",
+ "license": "MIT",
+ "repository": "sindresorhus/grunt-sass",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "http://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "scripts": {
+ "test": "grunt"
+ },
+ "files": [
+ "tasks"
+ ],
"keywords": [
"gruntplugin",
"css",
@@ -13,35 +29,18 @@
"compile",
"libsass"
],
- "author": {
- "name": "Sindre Sorhus",
- "email": "sindresorhus@gmail.com",
- "url": "http://sindresorhus.com"
- },
- "repository": "sindresorhus/grunt-sass",
- "scripts": {
- "test": "grunt"
- },
"dependencies": {
- "node-sass": "^0.8.0",
"chalk": "^0.4.0",
- "each-async": "^0.1.2"
+ "each-async": "^0.1.2",
+ "node-sass": "^0.9.0",
+ "object-assign": "^0.3.1"
},
"devDependencies": {
"grunt": "^0.4.0",
"grunt-contrib-clean": "^0.5.0",
- "grunt-contrib-nodeunit": "^0.3.2"
+ "grunt-contrib-nodeunit": "^0.4.0"
},
"peerDependencies": {
"grunt": "^0.4.0"
- },
- "engines": {
- "node": ">=0.10.0"
- },
- "licenses": {
- "type": "MIT"
- },
- "files": [
- "tasks/sass.js"
- ]
+ }
}
View
@@ -1,85 +1,15 @@
# grunt-sass [![Build Status](https://travis-ci.org/sindresorhus/grunt-sass.svg?branch=master)](https://travis-ci.org/sindresorhus/grunt-sass)
-> Compile SCSS to CSS using [node-sass](https://github.com/andrew/node-sass)
+> Compile Sass to CSS using [node-sass](https://github.com/andrew/node-sass)
-**Bugs with the output should be submitted on the [libsass](https://github.com/hcatlin/libsass) repo which is the actual compiler.**
-Make sure to review its issue tracker for known bugs before using this task as it can bite you later on.
+*Issues with the output should be reported on the libsass [issue tracker](https://github.com/hcatlin/libsass/issues).*
+This task uses libsass which is an experimental Sass compiler in C++. In contrast to the original Ruby compiler, this one is much faster, but is missing some features, though improving quickly. Check out [grunt-contrib-sass](https://github.com/gruntjs/grunt-contrib-sass) if you prefer something more stable, but slower.
-## Overview
-This task uses the experimental and superfast Node.js based Sass compiler [node-sass](https://github.com/andrew/node-sass) (which only compiles .scss files).
-
-*Note that node-sass is currently under heavy development and might be unstable, there are also some stuff missing, like a compression option. Check out [grunt-contrib-sass](https://github.com/gruntjs/grunt-contrib-sass) (based on Ruby Sass) if you want something stable that also supports the old syntax, but in turn much slower.*
-
-
-## Getting Started
-
-If you haven't used [grunt][] before, be sure to check out the [Getting Started][] guide, as it explains how to create a [gruntfile][Getting Started] as well as install and use grunt plugins. Once you're familiar with that process, install this plugin with this command:
-
-```shell
-$ npm install --save-dev grunt-sass
-```
-
-Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
+## Example
```js
-grunt.loadNpmTasks('grunt-sass');
-```
-
-*Tip: the [load-grunt-tasks](https://github.com/sindresorhus/load-grunt-tasks) module makes it easier to load multiple grunt tasks.*
-
-[grunt]: http://gruntjs.com
-[Getting Started]: https://github.com/gruntjs/grunt/wiki/Getting-started
-
-
-## Documentation
-
-See the [Gruntfile](https://github.com/sindresorhus/grunt-sass/blob/master/Gruntfile.js) in this repo for a full example.
-
-Note: Files that begin with "_" are ignored even if they match the globbing pattern. This is done to match the expected [Sass partial behaviour](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#partials).
-
-### Options
-
-#### includePaths
-
-Type: `Array`
-Default: `[]`
-
-Import paths to include.
-
-#### outputStyle
-
-Type: `String`
-Default: `nested`
-Values: `'nested'`, `'compressed'`
-
-Specify the CSS output style.
-
-#### imagePath
-
-Type: `String`
-
-Represents the public image path. When using the `image-url()` function in a stylesheet, this path will be prepended to the path you supply. eg. Given an `imagePath` of `/path/to/images`, `background-image: image-url('image.png')` will compile to `background-image: url("/path/to/images/image.png")`.
-
-#### sourceComments
-
-Type: `String`
-Default: `'none'`
-Values: `'none'`, `'normal'`, `'map'`
-
-Set what debug information is included in the output file. The `map` option will create the source map file in your CSS destination.
-
-#### sourceMap
-
-Type: `String`
-
-If your `sourceComments` option is set to `map`, `sourceMap` allows setting a new path context for the referenced Sass files. The source map describes a path from your CSS file location, into the the folder where the Sass files are located. In most occasions this will work out-of-the-box but, in some cases, you may need to set a different output.
-
-
-### Example config
-
-```javascript
grunt.initConfig({
sass: { // task
dist: { // target
@@ -89,9 +19,7 @@ grunt.initConfig({
},
dev: { // another target
options: { // dictionary of render options
- includePaths: [
- 'path/to/imports/'
- ]
+ sourceMap: true
},
files: {
'main.css': 'main.scss'
@@ -105,59 +33,41 @@ grunt.registerTask('default', ['sass']);
```
-### Example usage
+## API
+Files starting with `_` are ignored to match the expected [Sass partial behaviour](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#partials).
-#### Compile
+### Options
-```javascript
-grunt.initConfig({
- sass: {
- dist: {
- files: {
- 'main.css': 'main.scss'
- }
- }
- }
-});
-```
+#### includePaths
+Type: `array`
+Default: `[]`
-#### Compile with options
+Import paths to include.
-```js
-grunt.initConfig({
- sass: {
- dist: {
- options: {
- includePaths: ['imports/are/here/'],
- outputStyle: 'nested'
- },
- files: {
- 'main.css': 'main.scss'
- }
- }
- }
-});
-```
+#### outputStyle
+Type: `string`
+Default: `nested`
+Values: `'nested'`, `'compressed'`
-#### Compile multiple files
+Specify the CSS output style.
-You can also compile multiple files into multiple destinations.
+#### imagePath
-```js
-grunt.initConfig({
- sass: {
- files: {
- 'main.css': 'main.scss',
- 'widgets.css': 'widgets.scss'
- }
- }
-});
-```
+Type: `string`
+
+Represents the public image path. When using the `image-url()` function in a stylesheet, this path will be prepended to the path you supply. Example: Given an `imagePath` of `/path/to/images`, `background-image: image-url('image.png')` will compile to `background-image: url("/path/to/images/image.png")`.
+
+#### sourceMap
+
+Type: `boolean`, `string`
+Default: `false`
+
+Set it to `true` to output a Source Map to the same location as the CSS *(output.css.map)*, or specify a path relative to the CSS file to where you want the Source Map.
## License
-[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
+MIT © [Sindre Sorhus](http://sindresorhus.com)
Oops, something went wrong.

0 comments on commit f18b613

Please sign in to comment.