updated sys and created publi
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
|
||||
[*]
|
||||
|
||||
# Change these settings to your own preference
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# We recommend you to keep these unchanged
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
root: true
|
||||
|
||||
env:
|
||||
mocha: true
|
||||
node: true
|
||||
|
||||
# globals:
|
||||
#########################
|
||||
## Only add globals if you're absolutely certain they need to be globals
|
||||
##########################
|
||||
# console: true
|
||||
|
||||
#########################
|
||||
## set to 0 to allow
|
||||
## set to 1 to disallow as warning
|
||||
## set to 2 to disallow as error
|
||||
#########################
|
||||
rules:
|
||||
#########################
|
||||
## Optional Rules
|
||||
#########################
|
||||
# Disallow use of `console`
|
||||
no-console: 2
|
||||
|
||||
# Disallow warning comments
|
||||
no-warning-comments:
|
||||
- 1
|
||||
- terms:
|
||||
- todo
|
||||
- fixme
|
||||
location: anywhere
|
||||
|
||||
# Warns when variables are defined but never used
|
||||
no-unused-vars: 1
|
||||
|
||||
# Enforces comma style (first or last)
|
||||
comma-style:
|
||||
- 2
|
||||
- last
|
||||
|
||||
# Enforces one true `this` variable
|
||||
consistent-this:
|
||||
- 2
|
||||
- self
|
||||
# Allows dangling underscores in identifiers
|
||||
no-underscore-dangle: 2
|
||||
|
||||
# Enforces function expressions to have a name
|
||||
func-names: 0
|
||||
|
||||
# Set maximum depth of nested callbacks
|
||||
max-nested-callbacks:
|
||||
- 1
|
||||
- 3
|
||||
|
||||
#########################
|
||||
## Core Rules
|
||||
##########################
|
||||
# Enforces camel case names
|
||||
camelcase: 2
|
||||
|
||||
# Prohibit use of == and != in favor of === and !==
|
||||
eqeqeq: 2
|
||||
|
||||
# Suppresses warnings about == null comparisons
|
||||
no-eq-null: 2
|
||||
|
||||
# No mixing tabs and spaces, with 2 spaces only
|
||||
no-mixed-spaces-and-tabs: 2
|
||||
|
||||
# Prohibits use of a variable before it is defined
|
||||
no-use-before-define: 2
|
||||
|
||||
# Requires capitalized names for constructor functions
|
||||
new-cap: 2
|
||||
|
||||
# Prohibits use of explicitly undeclared variables
|
||||
no-undef: 2
|
||||
|
||||
# Enforces Use Strict at the top of function scope
|
||||
strict:
|
||||
- 2
|
||||
- global
|
||||
|
||||
# Requires variable declarations to be at the top
|
||||
vars-on-top: 2
|
||||
|
||||
# Enforce curly braces around blocks in loops and conditionals
|
||||
curly: 2
|
||||
|
||||
# Prohibits the use of immediate function invocations w/o wrapping in parentheses
|
||||
wrap-iife: 2
|
||||
|
||||
# Prohibits `argument.caller` and `argument.callee`
|
||||
no-caller: 2
|
||||
|
||||
# Requires all `for in` loops to filter object's items
|
||||
guard-for-in: 2
|
||||
|
||||
# Prohibits comparing a variable against itself
|
||||
no-self-compare: 2
|
||||
|
||||
# Prohibits use of `undefined` variable
|
||||
no-undefined: 0
|
||||
|
||||
# Prohibits nested ternaries
|
||||
no-nested-ternary: 2
|
||||
|
||||
# Enforces a space before blocks
|
||||
space-before-blocks:
|
||||
- 2
|
||||
- always
|
||||
|
||||
# Enforces spaces following keywords
|
||||
keyword-spacing:
|
||||
- 2
|
||||
- after: true
|
||||
|
||||
# Enforces quoted property names
|
||||
quote-props:
|
||||
- 2
|
||||
- always
|
||||
|
||||
# Enforces padded blocks
|
||||
padded-blocks:
|
||||
- 1
|
||||
- never
|
||||
|
||||
# Enforce functions as expressions
|
||||
func-style:
|
||||
- 2
|
||||
- expression
|
||||
|
||||
# Require brace style
|
||||
brace-style:
|
||||
- 2
|
||||
- stroustrup
|
||||
|
||||
# Prohibits Yoda conditions
|
||||
yoda:
|
||||
- 2
|
||||
- never
|
||||
|
||||
# Enforce use of single quotation marks for strings.
|
||||
quotes:
|
||||
- 2
|
||||
- single
|
||||
|
||||
# Disallow or enforce spaces inside of curly braces in objects.
|
||||
object-curly-spacing:
|
||||
- 2
|
||||
- always
|
||||
|
||||
# Disallow or enforce spaces inside of brackets.
|
||||
array-bracket-spacing:
|
||||
- 2
|
||||
- never
|
||||
|
||||
# Disallow or enforce spaces inside of computed properties.
|
||||
computed-property-spacing:
|
||||
- 2
|
||||
- never
|
||||
+1
@@ -0,0 +1 @@
|
||||
test
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- node
|
||||
- iojs
|
||||
sudo: false
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
# Gulp Sass Changelog
|
||||
|
||||
## v2.1.0-beta
|
||||
**September 21, 2015**
|
||||
|
||||
* **Change** :arrow_up: Bump to Node Sass 3.4.0-beta1
|
||||
|
||||
## v2.0.4
|
||||
**July 15, 2015**
|
||||
|
||||
* **Fix** Relative file path now uses `file.relative` instead of arcane `split('/').pop` magic. Resolves lots of issues with source map paths.
|
||||
|
||||
* **Fix** Empty partials no longer copied to CSS folder
|
||||
|
||||
## v2.0.3
|
||||
**June 27, 2015**
|
||||
|
||||
* **Fix** Empty partials no longer copied to CSS folder
|
||||
|
||||
## v2.0.2
|
||||
**June 25, 2015**
|
||||
|
||||
* **Fix** Error in watch stream preventing watch from continuing
|
||||
|
||||
## v2.0.1
|
||||
**May 13, 2015**
|
||||
|
||||
* **Fix** Source maps now work as expected with Autoprefixer
|
||||
* **Fix** Current file directory `unshift` onto includePaths stack so it's checked first
|
||||
* **Fix** Error message returned is unformatted so as to not break other error handling (*i.e.* `gulp-notify`)
|
||||
|
||||
## v2.0.0
|
||||
**May 6, 2015**
|
||||
|
||||
* **Change** :arrow_up: Bump to Node Sass 3.0.0
|
||||
|
||||
## v2.0.0-alpha.1
|
||||
**March 26, 2015**
|
||||
|
||||
* **New** Added `renderSync` option that can be used through `sass.sync()`
|
||||
|
||||
### March 24, 2015
|
||||
* **Change** Updated to `node-sass` 3.0.0-alpha.1
|
||||
* **New** Added support for `gulp-sourcemaps` including tests
|
||||
* **New** Added `.editorconfig` for development consistency
|
||||
* **New** Added linting and test for said linting
|
||||
* **Change** Updated the README
|
||||
* **New** `logError` function to make streaming errors possible instead of breaking the stream
|
||||
|
||||
### 1.3.3
|
||||
|
||||
* updated to node-sass 2.0 (final)
|
||||
* should now work with node 0.12 and io.js
|
||||
|
||||
### 1.3.2
|
||||
|
||||
* fixed errLogToConsole
|
||||
|
||||
### 1.3.1
|
||||
|
||||
* bug fix
|
||||
|
||||
## Version 1.3.0
|
||||
|
||||
* Supports node-sass 2.0 (thanks laurelnaiad!)
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
# Contributing to Gulp Sass
|
||||
|
||||
Gulp Sass is a very light-weight [Gulp](https://github.com/gulpjs/gulp) wrapper for [`node-sass`](https://github.com/sass/node-sass), which in turn is a Node binding for [`libsass`](https://github.com/sass/libsass), which in turn is a port of [`Sass`](https://github.com/sass/sass).
|
||||
|
||||
## Submitting Issues
|
||||
|
||||
* Before creating a new issue, perform a [cursory search](https://github.com/issues?utf8=%E2%9C%93&q=repo%3Adlmanning%2Fgulp-sass+repo%3Asass%2Fnode-sass+repo%3Asass%2Flibsass+repo%3Asass%2Fsass+repo%3Asass-eyeglass%2Feyeglass) in the Gulp Sass, Node Sass, Libsass, and main Sass repos to see if a similar issue has already been submitted. Please also refer to our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) page for some basic troubleshooting.
|
||||
* You can create an issue [here](https://github.com/dlmanning/gulp-sass/issues). Please include as many details as possible in your report.
|
||||
* Issue titles should be descriptive, explaining at the high level what it is about.
|
||||
* Please include the version of `gulp-sass`, Node, and NPM you are using, as well as what operating system you are having a problem on.
|
||||
* _Do not open a [pull request](#pull-requests) to resolve an issue without first receiving feedback from a `collaborator` or `owner` and having them agree on a solution forward_.
|
||||
* Include screenshots and animated GIFs whenever possible; they are immensely helpful.
|
||||
* Issues that have a number of sub-items that need to be complete should use [task lists](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments) to track the sub-items in the main issue comment.
|
||||
|
||||
|
||||
## Pull Requests
|
||||
|
||||
* **DO NOT ISSUE A PULL REQUEST WITHOUT FIRST [SUBMITTING AN ISSUE](#submitting-issues)**
|
||||
* Pull requests should reference their related issues. If the pull request closes an issue, [please reference its closing in your commit messages](https://help.github.com/articles/closing-issues-via-commit-messages/). Pull requests not referencing any issues will be closed.
|
||||
* Pull request titles should be descriptive, explaining at the high level what it is doing, and should be written in the same style as [Git commit messages](#git-commit-messages).
|
||||
* Update the `CHANGELOG` with the changes made by your pull request, making sure to use the proper [Emoji](#emoji-cheatsheet).
|
||||
* Follow our JavaScript styleguides. Tests will fail if you do not.
|
||||
* Ensure that you have [EditorConfig](http://editorconfig.org/) installed in your editor of choice and that it is functioning properly.
|
||||
* Do not squash or rebase your commits when submitting a Pull Request. It makes it much harder to follow your work and make incremental changes.
|
||||
* Update the [CHANGELOG](#maintaining-thechangelog) with your changes.
|
||||
* Branches should be made off of the most current `master` branch from `git@github.com:dlmanning/gulp-sass.git`
|
||||
* Pull requests should be made into our [master](https://github.com/dlmanning/gulp-sass/tree/master) branch.
|
||||
|
||||
### Git Commit Messages
|
||||
|
||||
* Use the present tense (`"Add feature"` not `"Added Feature"`)
|
||||
* Use the imperative mood (`"Move cursor to…"` not `"Moves cursor to…"`)
|
||||
* Limit the first line to 72 characters or less
|
||||
* Consider including relevant Emoji from our [Emoji cheatsheet](#emoji-cheatsheet)
|
||||
|
||||
## Creating a New Version
|
||||
|
||||
Versioning is done through [SEMVER](http://semver.org/). When creating a new version, create new release branch off of `master` with the version's name, and create a new tag with `v` prefixed with the version's name from that branch.
|
||||
|
||||
For instance, if you are creating version `1.1.0`, you would create a branch `release/1.1.0` from `master` and create a tag `v1.1.0` from branch `release/1.1.0`.
|
||||
|
||||
### Maintaining the Changelog
|
||||
|
||||
The Changelog should have a list of changes made for each version. They should be organized so additions come first, changes come second, and deletions come third. Version numbers should be 2nd level headers with the `v` in front (like a tag) and the date of the version's most recent update should be underneath in italics.
|
||||
|
||||
Changelog messages do not need to cover each individual commit made, but rather should have individual summaries of the changes made. Changelog messages should be written in the same style as [Git commit messages](#git-commit-messages).
|
||||
|
||||
## Emoji Cheatsheet
|
||||
|
||||
When creating creating commits or updating the CHANGELOG, please **start** the commit message or update with one of the following applicable Emoji. Emoji should not be used at the start of issue or pull request titles.
|
||||
|
||||
* :art: `:art:` when improving the format/structure of the code
|
||||
* :racehorse: `:racehorse:` when improving performance
|
||||
* :memo: `:memo:` when writing long-form text (documentation, guidelines, principles, etc…)
|
||||
* :bug: `:bug:` when fixing a bug
|
||||
* :fire: `:fire:` when removing code or files
|
||||
* :green_heart: `:green_heart:` when fixing the CI build
|
||||
* :white_check_mark: `:white_check_mark:` when adding tests
|
||||
* :lock: `:lock:` when dealing with security
|
||||
* :arrow_up: `:arrow_up:` when upgrading dependencies
|
||||
* :arrow_down: `:arrow_down:` when downgrading dependencies
|
||||
* :shirt: `:shirt:` when removing linter warnings
|
||||
* :shipit: `:shipit:` when creating a new release
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 David Manning
|
||||
|
||||
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.
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
# gulp-sass [](https://travis-ci.org/dlmanning/gulp-sass) [](https://gitter.im/dlmanning/gulp-sass?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](http://badge.fury.io/js/gulp-sass)
|
||||
|
||||
Sass plugin for [Gulp](https://github.com/gulpjs/gulp).
|
||||
|
||||
**_Before filing an issue, please make sure you have [Updated to the latest Gulp Sass](https://github.com/dlmanning/gulp-sass/wiki/Update-to-the-latest-Gulp-Sass) and have gone through our [Common Issues and Their Fixes](https://github.com/dlmanning/gulp-sass/wiki/Common-Issues-and-Their-Fixes) section._**
|
||||
|
||||
# Install
|
||||
|
||||
```
|
||||
npm install gulp-sass --save-dev
|
||||
```
|
||||
|
||||
# Basic Usage
|
||||
|
||||
Something like this will compile your Sass files:
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var sass = require('gulp-sass');
|
||||
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./sass/**/*.scss')
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
|
||||
gulp.task('sass:watch', function () {
|
||||
gulp.watch('./sass/**/*.scss', ['sass']);
|
||||
});
|
||||
```
|
||||
|
||||
You can also compile synchronously, doing something like this:
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp');
|
||||
var sass = require('gulp-sass');
|
||||
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./sass/**/*.scss')
|
||||
.pipe(sass.sync().on('error', sass.logError))
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
|
||||
gulp.task('sass:watch', function () {
|
||||
gulp.watch('./sass/**/*.scss', ['sass']);
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
Pass in options just like you would for [`node-sass`](https://github.com/sass/node-sass#options); they will be passed along just as if you were using `node-sass`. Except for the `data` option which is used by gulp-sass internally. Using the `file` option is also unsupported and results in undefined behaviour that may change without notice.
|
||||
|
||||
For example:
|
||||
|
||||
```javascript
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./sass/**/*.scss')
|
||||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
```
|
||||
|
||||
## Source Maps
|
||||
|
||||
`gulp-sass` can be used in tandem with [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) to generate source maps for the Sass to CSS compilation. You will need to initialize [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) prior to running `gulp-sass` and write the source maps after.
|
||||
|
||||
```javascript
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./sass/**/*.scss')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
```
|
||||
|
||||
By default, [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) writes the source maps inline in the compiled CSS files. To write them to a separate file, specify a path relative to the `gulp.dest()` destination in the `sourcemaps.write()` function.
|
||||
|
||||
```javascript
|
||||
var sourcemaps = require('gulp-sourcemaps');
|
||||
gulp.task('sass', function () {
|
||||
return gulp.src('./sass/**/*.scss')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(sass().on('error', sass.logError))
|
||||
.pipe(sourcemaps.write('./maps'))
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
```
|
||||
|
||||
# Issues
|
||||
|
||||
`gulp-sass` is a very light-weight wrapper around [`node-sass`](https://github.com/sass/node-sass), which in turn is a Node binding for [`libsass`](https://github.com/sass/libsass), which in turn is a port of [`Sass`](https://github.com/sass/sass). Because of this, the issue you're having likely isn't a `gulp-sass` issue, but an issue with one of those three projects.
|
||||
|
||||
If you have a feature request/question how Sass works/concerns on how your Sass gets compiled/errors in your compiling, it's likely a `libsass` or `Sass` issue and you should file your issue with one of those projects.
|
||||
|
||||
If you're having problems with the options you're passing in, it's likely a `node-sass` or `libsass` issue and you should file your issue with one of those projects.
|
||||
|
||||
We may, in the course of resolving issues, direct you to one of these other projects. If we do so, please follow up by searching that project's issue queue (both open and closed) for your problem and, if it doesn't exist, filing an issue with them.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/* line 1, /Users/xzyfer/Projects/Sass/upstream/gulp-sass/test.scss */
|
||||
foo {
|
||||
bar: '1';
|
||||
}
|
||||
|
||||
/* line 5, /Users/xzyfer/Projects/Sass/upstream/gulp-sass/test.scss */
|
||||
foo {
|
||||
bar: '2';
|
||||
}
|
||||
|
||||
/* line 9, /Users/xzyfer/Projects/Sass/upstream/gulp-sass/test.scss */
|
||||
foo {
|
||||
bar: '3';
|
||||
}
|
||||
|
||||
/* line 13, /Users/xzyfer/Projects/Sass/upstream/gulp-sass/test.scss */
|
||||
foo {
|
||||
bar: '4';
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
'use strict';
|
||||
|
||||
var gutil = require('gulp-util');
|
||||
var through = require('through2');
|
||||
var clonedeep = require('lodash.clonedeep');
|
||||
var path = require('path');
|
||||
var applySourceMap = require('vinyl-sourcemaps-apply');
|
||||
|
||||
var PLUGIN_NAME = 'gulp-sass';
|
||||
|
||||
//////////////////////////////
|
||||
// Main Gulp Sass function
|
||||
//////////////////////////////
|
||||
var gulpSass = function gulpSass(options, sync) {
|
||||
return through.obj(function(file, enc, cb) {
|
||||
var opts,
|
||||
filePush,
|
||||
errorM,
|
||||
callback,
|
||||
result;
|
||||
|
||||
if (file.isNull()) {
|
||||
return cb(null, file);
|
||||
}
|
||||
if (file.isStream()) {
|
||||
return cb(new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
|
||||
}
|
||||
if (path.basename(file.path).indexOf('_') === 0) {
|
||||
return cb();
|
||||
}
|
||||
if (!file.contents.length) {
|
||||
file.path = gutil.replaceExtension(file.path, '.css');
|
||||
return cb(null, file);
|
||||
}
|
||||
|
||||
|
||||
opts = clonedeep(options || {});
|
||||
opts.data = file.contents.toString();
|
||||
|
||||
// we set the file path here so that libsass can correctly resolve import paths
|
||||
opts.file = file.path;
|
||||
|
||||
// Ensure `indentedSyntax` is true if a `.sass` file
|
||||
if (path.extname(file.path) === '.sass') {
|
||||
opts.indentedSyntax = true;
|
||||
}
|
||||
|
||||
// Ensure file's parent directory in the include path
|
||||
if (opts.includePaths) {
|
||||
if (typeof opts.includePaths === 'string') {
|
||||
opts.includePaths = [opts.includePaths];
|
||||
}
|
||||
}
|
||||
else {
|
||||
opts.includePaths = [];
|
||||
}
|
||||
|
||||
opts.includePaths.unshift(path.dirname(file.path));
|
||||
|
||||
// Generate Source Maps if plugin source-map present
|
||||
if (file.sourceMap) {
|
||||
opts.sourceMap = file.path;
|
||||
opts.omitSourceMapUrl = true;
|
||||
opts.sourceMapContents = true;
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
// Handles returning the file to the stream
|
||||
//////////////////////////////
|
||||
filePush = function filePush(sassObj) {
|
||||
var sassMap,
|
||||
sassMapFile,
|
||||
sassFileSrc,
|
||||
sassFileSrcPath,
|
||||
sourceFileIndex;
|
||||
|
||||
// Build Source Maps!
|
||||
if (sassObj.map) {
|
||||
// Transform map into JSON
|
||||
sassMap = JSON.parse(sassObj.map.toString());
|
||||
// Grab the stdout and transform it into stdin
|
||||
sassMapFile = sassMap.file.replace(/^stdout$/, 'stdin');
|
||||
// Grab the base file name that's being worked on
|
||||
sassFileSrc = file.relative;
|
||||
// Grab the path portion of the file that's being worked on
|
||||
sassFileSrcPath = path.dirname(sassFileSrc);
|
||||
if (sassFileSrcPath) {
|
||||
//Prepend the path to all files in the sources array except the file that's being worked on
|
||||
sourceFileIndex = sassMap.sources.indexOf(sassMapFile);
|
||||
sassMap.sources = sassMap.sources.map(function(source, index) {
|
||||
return (index === sourceFileIndex) ? source : path.join(sassFileSrcPath, source);
|
||||
});
|
||||
}
|
||||
|
||||
// Remove 'stdin' from souces and replace with filenames!
|
||||
sassMap.sources = sassMap.sources.filter(function(src) {
|
||||
if (src !== 'stdin') {
|
||||
return src;
|
||||
}
|
||||
});
|
||||
|
||||
// Replace the map file with the original file name (but new extension)
|
||||
sassMap.file = gutil.replaceExtension(sassFileSrc, '.css');
|
||||
// Apply the map
|
||||
applySourceMap(file, sassMap);
|
||||
}
|
||||
|
||||
file.contents = sassObj.css;
|
||||
file.path = gutil.replaceExtension(file.path, '.css');
|
||||
|
||||
cb(null, file);
|
||||
};
|
||||
|
||||
//////////////////////////////
|
||||
// Handles error message
|
||||
//////////////////////////////
|
||||
errorM = function errorM(error) {
|
||||
var relativePath = '',
|
||||
filePath = error.file === 'stdin' ? file.path : error.file,
|
||||
message = '';
|
||||
|
||||
filePath = filePath ? filePath : file.path;
|
||||
relativePath = path.relative(process.cwd(), filePath);
|
||||
|
||||
message += gutil.colors.underline(relativePath) + '\n';
|
||||
message += error.formatted;
|
||||
|
||||
error.messageFormatted = message;
|
||||
error.messageOriginal = error.message;
|
||||
error.message = gutil.colors.stripColor(message);
|
||||
|
||||
error.relativePath = relativePath;
|
||||
|
||||
return cb(new gutil.PluginError(
|
||||
PLUGIN_NAME, error
|
||||
));
|
||||
};
|
||||
|
||||
if (sync !== true) {
|
||||
//////////////////////////////
|
||||
// Async Sass render
|
||||
//////////////////////////////
|
||||
callback = function(error, obj) {
|
||||
if (error) {
|
||||
return errorM(error);
|
||||
}
|
||||
filePush(obj);
|
||||
};
|
||||
|
||||
gulpSass.compiler.render(opts, callback);
|
||||
}
|
||||
else {
|
||||
//////////////////////////////
|
||||
// Sync Sass render
|
||||
//////////////////////////////
|
||||
try {
|
||||
result = gulpSass.compiler.renderSync(opts);
|
||||
|
||||
filePush(result);
|
||||
}
|
||||
catch (error) {
|
||||
return errorM(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
//////////////////////////////
|
||||
// Sync Sass render
|
||||
//////////////////////////////
|
||||
gulpSass.sync = function sync(options) {
|
||||
return gulpSass(options, true);
|
||||
};
|
||||
|
||||
//////////////////////////////
|
||||
// Log errors nicely
|
||||
//////////////////////////////
|
||||
gulpSass.logError = function logError(error) {
|
||||
var message = new gutil.PluginError('sass', error.messageFormatted).toString();
|
||||
process.stderr.write(message + '\n');
|
||||
this.emit('end');
|
||||
};
|
||||
|
||||
//////////////////////////////
|
||||
// Store compiler in a prop
|
||||
//////////////////////////////
|
||||
gulpSass.compiler = require('node-sass');
|
||||
|
||||
module.exports = gulpSass;
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"_from": "gulp-sass@latest",
|
||||
"_id": "gulp-sass@3.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-U9xLaKH13f5EJKtMJHZVJpqLdLc=",
|
||||
"_location": "/gulp-sass",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "gulp-sass@latest",
|
||||
"name": "gulp-sass",
|
||||
"escapedName": "gulp-sass",
|
||||
"rawSpec": "latest",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-3.1.0.tgz",
|
||||
"_shasum": "53dc4b68a1f5ddfe4424ab4c247655269a8b74b7",
|
||||
"_spec": "gulp-sass@latest",
|
||||
"_where": "/mnt/Data/bach/Documents/ola/OLA#5/ola5doc/publi",
|
||||
"author": {
|
||||
"name": "David Manning"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/dlmanning/gulp-sass/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"gulp-util": "^3.0",
|
||||
"lodash.clonedeep": "^4.3.2",
|
||||
"node-sass": "^4.2.0",
|
||||
"through2": "^2.0.0",
|
||||
"vinyl-sourcemaps-apply": "^0.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Gulp plugin for sass",
|
||||
"devDependencies": {
|
||||
"autoprefixer-core": "^5.2.1",
|
||||
"eslint": "^2.9.0",
|
||||
"globule": "^1.0.0",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-postcss": "^5.1.10",
|
||||
"gulp-sourcemaps": "^1.5.2",
|
||||
"gulp-tap": "^0.1.3",
|
||||
"mocha": "^2.2.1",
|
||||
"rimraf": "^2.4.3",
|
||||
"should": "^8.3.1"
|
||||
},
|
||||
"homepage": "https://github.com/dlmanning/gulp-sass#readme",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"sass",
|
||||
"gulp"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "gulp-sass",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/dlmanning/gulp-sass.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test"
|
||||
},
|
||||
"version": "3.1.0"
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
var gulp = require('gulp');
|
||||
var sass = require('.');
|
||||
|
||||
gulp.task('sass', function() {
|
||||
gulp.src('*.scss')
|
||||
.pipe(sass({
|
||||
sourceComments: true,
|
||||
outputStyle: 'expanded',
|
||||
errLogToConsole: true
|
||||
}))
|
||||
.pipe(gulp.dest('dest'));
|
||||
});
|
||||
|
||||
gulp.task('watch', ['sass'], function() {
|
||||
var sassWatcher = gulp.watch('*.scss', ['sass']);
|
||||
});
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
foo {
|
||||
bar: '1';
|
||||
}
|
||||
|
||||
foo {
|
||||
bar: '2';
|
||||
}
|
||||
|
||||
foo {
|
||||
bar: '3';
|
||||
}
|
||||
|
||||
foo {
|
||||
bar: '4';
|
||||
}
|
||||
Reference in New Issue
Block a user