Added Gulp.js for compiling SCSS stylesheets
This commit is contained in:
4
node_modules/vinyl-sourcemaps-apply/.jshintrc
generated
vendored
Normal file
4
node_modules/vinyl-sourcemaps-apply/.jshintrc
generated
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"node": true,
|
||||
"strict": true
|
||||
}
|
2
node_modules/vinyl-sourcemaps-apply/.npmignore
generated
vendored
Normal file
2
node_modules/vinyl-sourcemaps-apply/.npmignore
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.DS_Store
|
||||
node_modules
|
42
node_modules/vinyl-sourcemaps-apply/README.md
generated
vendored
Normal file
42
node_modules/vinyl-sourcemaps-apply/README.md
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# vinyl-sourcemaps-apply
|
||||
|
||||
Apply a source map to a vinyl file, merging it with preexisting source maps.
|
||||
|
||||
## Usage:
|
||||
|
||||
```javascript
|
||||
var applySourceMap = require('vinyl-sourcemaps-apply');
|
||||
applySourceMap(vinylFile, sourceMap);
|
||||
```
|
||||
|
||||
### Example (Gulp plugin):
|
||||
|
||||
```javascript
|
||||
var through = require('through2');
|
||||
var applySourceMap = require('vinyl-sourcemaps-apply');
|
||||
var myTransform = require('myTransform');
|
||||
|
||||
module.exports = function(options) {
|
||||
|
||||
function transform(file, encoding, callback) {
|
||||
// generate source maps if plugin source-map present
|
||||
if (file.sourceMap) {
|
||||
options.makeSourceMaps = true;
|
||||
}
|
||||
|
||||
// do normal plugin logic
|
||||
var result = myTransform(file.contents, options);
|
||||
file.contents = new Buffer(result.code);
|
||||
|
||||
// apply source map to the chain
|
||||
if (file.sourceMap) {
|
||||
applySourceMap(file, result.map);
|
||||
}
|
||||
|
||||
this.push(file);
|
||||
callback();
|
||||
}
|
||||
|
||||
return through.obj(transform);
|
||||
};
|
||||
```
|
39
node_modules/vinyl-sourcemaps-apply/index.js
generated
vendored
Normal file
39
node_modules/vinyl-sourcemaps-apply/index.js
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
var SourceMapGenerator = require('source-map').SourceMapGenerator;
|
||||
var SourceMapConsumer = require('source-map').SourceMapConsumer;
|
||||
|
||||
module.exports = function applySourceMap(file, sourceMap) {
|
||||
if (typeof sourceMap === 'string' || sourceMap instanceof String) {
|
||||
sourceMap = JSON.parse(sourceMap);
|
||||
}
|
||||
|
||||
if (file.sourceMap && (typeof file.sourceMap === 'string' || file.sourceMap instanceof String)) {
|
||||
file.sourceMap = JSON.parse(file.sourceMap);
|
||||
}
|
||||
|
||||
// check source map properties
|
||||
assertProperty(sourceMap, "file");
|
||||
assertProperty(sourceMap, "mappings");
|
||||
assertProperty(sourceMap, "sources");
|
||||
|
||||
// fix paths if Windows style paths
|
||||
sourceMap.file = sourceMap.file.replace(/\\/g, '/');
|
||||
sourceMap.sources = sourceMap.sources.map(function(filePath) {
|
||||
return filePath.replace(/\\/g, '/');
|
||||
});
|
||||
|
||||
if (file.sourceMap && file.sourceMap.mappings !== '') {
|
||||
var generator = SourceMapGenerator.fromSourceMap(new SourceMapConsumer(sourceMap));
|
||||
generator.applySourceMap(new SourceMapConsumer(file.sourceMap));
|
||||
file.sourceMap = JSON.parse(generator.toString());
|
||||
} else {
|
||||
file.sourceMap = sourceMap;
|
||||
}
|
||||
};
|
||||
|
||||
function assertProperty(sourceMap, propertyName) {
|
||||
if (!sourceMap.hasOwnProperty(propertyName)) {
|
||||
var e = new Error('Source map to be applied is missing the \"' + propertyName + '\" property');
|
||||
throw e;
|
||||
}
|
||||
}
|
22
node_modules/vinyl-sourcemaps-apply/package.json
generated
vendored
Normal file
22
node_modules/vinyl-sourcemaps-apply/package.json
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "vinyl-sourcemaps-apply",
|
||||
"version": "0.2.1",
|
||||
"description": "Apply a source map to a vinyl file, merging it with preexisting source maps",
|
||||
"homepage": "http://github.com/floridoo/vinyl-sourcemaps-apply",
|
||||
"repository": "git://github.com/floridoo/vinyl-sourcemaps-apply.git",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [
|
||||
"vinyl",
|
||||
"sourcemaps",
|
||||
"source maps",
|
||||
"gulp"
|
||||
],
|
||||
"author": "Florian Reiterer <me@florianreiterer.com>",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"source-map": "^0.5.1"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user