Added Gulp.js for compiling SCSS stylesheets
This commit is contained in:
		
							
								
								
									
										45
									
								
								node_modules/vinyl-fs/lib/dest/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								node_modules/vinyl-fs/lib/dest/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var lead = require('lead'); | ||||
| var pumpify = require('pumpify'); | ||||
| var mkdirpStream = require('fs-mkdirp-stream'); | ||||
| var createResolver = require('resolve-options'); | ||||
|  | ||||
| var config = require('./options'); | ||||
| var prepare = require('./prepare'); | ||||
| var sourcemap = require('./sourcemap'); | ||||
| var writeContents = require('./write-contents'); | ||||
|  | ||||
| var folderConfig = { | ||||
|   outFolder: { | ||||
|     type: 'string', | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| function dest(outFolder, opt) { | ||||
|   if (!outFolder) { | ||||
|     throw new Error('Invalid dest() folder argument.' + | ||||
|       ' Please specify a non-empty string or a function.'); | ||||
|   } | ||||
|  | ||||
|   var optResolver = createResolver(config, opt); | ||||
|   var folderResolver = createResolver(folderConfig, { outFolder: outFolder }); | ||||
|  | ||||
|   function dirpath(file, callback) { | ||||
|     var dirMode = optResolver.resolve('dirMode', file); | ||||
|  | ||||
|     callback(null, file.dirname, dirMode); | ||||
|   } | ||||
|  | ||||
|   var saveStream = pumpify.obj( | ||||
|     prepare(folderResolver, optResolver), | ||||
|     sourcemap(optResolver), | ||||
|     mkdirpStream.obj(dirpath), | ||||
|     writeContents(optResolver) | ||||
|   ); | ||||
|  | ||||
|   // Sink the output stream to start flowing | ||||
|   return lead(saveStream); | ||||
| } | ||||
|  | ||||
| module.exports = dest; | ||||
							
								
								
									
										41
									
								
								node_modules/vinyl-fs/lib/dest/options.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								node_modules/vinyl-fs/lib/dest/options.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var config = { | ||||
|   cwd: { | ||||
|     type: 'string', | ||||
|     default: process.cwd, | ||||
|   }, | ||||
|   mode: { | ||||
|     type: 'number', | ||||
|     default: function(file) { | ||||
|       return file.stat ? file.stat.mode : null; | ||||
|     }, | ||||
|   }, | ||||
|   dirMode: { | ||||
|     type: 'number', | ||||
|   }, | ||||
|   overwrite: { | ||||
|     type: 'boolean', | ||||
|     default: true, | ||||
|   }, | ||||
|   append: { | ||||
|     type: 'boolean', | ||||
|     default: false, | ||||
|   }, | ||||
|   sourcemaps: { | ||||
|     type: ['string', 'boolean'], | ||||
|     default: false, | ||||
|   }, | ||||
|   // Symlink options | ||||
|   relativeSymlinks: { | ||||
|     type: 'boolean', | ||||
|     default: false, | ||||
|   }, | ||||
|   // This option is ignored on non-Windows platforms | ||||
|   useJunctions: { | ||||
|     type: 'boolean', | ||||
|     default: true, | ||||
|   }, | ||||
| }; | ||||
|  | ||||
| module.exports = config; | ||||
							
								
								
									
										48
									
								
								node_modules/vinyl-fs/lib/dest/prepare.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								node_modules/vinyl-fs/lib/dest/prepare.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,48 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var path = require('path'); | ||||
|  | ||||
| var fs = require('graceful-fs'); | ||||
| var Vinyl = require('vinyl'); | ||||
| var through = require('through2'); | ||||
|  | ||||
| function prepareWrite(folderResolver, optResolver) { | ||||
|   if (!folderResolver) { | ||||
|     throw new Error('Invalid output folder'); | ||||
|   } | ||||
|  | ||||
|   function normalize(file, enc, cb) { | ||||
|     if (!Vinyl.isVinyl(file)) { | ||||
|       return cb(new Error('Received a non-Vinyl object in `dest()`')); | ||||
|     } | ||||
|  | ||||
|     // TODO: Remove this after people upgrade vinyl/transition from gulp-util | ||||
|     if (typeof file.isSymbolic !== 'function') { | ||||
|       file = new Vinyl(file); | ||||
|     } | ||||
|  | ||||
|     var outFolderPath = folderResolver.resolve('outFolder', file); | ||||
|     if (!outFolderPath) { | ||||
|       return cb(new Error('Invalid output folder')); | ||||
|     } | ||||
|     var cwd = path.resolve(optResolver.resolve('cwd', file)); | ||||
|     var basePath = path.resolve(cwd, outFolderPath); | ||||
|     var writePath = path.resolve(basePath, file.relative); | ||||
|  | ||||
|     // Wire up new properties | ||||
|     file.cwd = cwd; | ||||
|     file.base = basePath; | ||||
|     file.path = writePath; | ||||
|     if (!file.isSymbolic()) { | ||||
|       var mode = optResolver.resolve('mode', file); | ||||
|       file.stat = (file.stat || new fs.Stats()); | ||||
|       file.stat.mode = mode; | ||||
|     } | ||||
|  | ||||
|     cb(null, file); | ||||
|   } | ||||
|  | ||||
|   return through.obj(normalize); | ||||
| } | ||||
|  | ||||
| module.exports = prepareWrite; | ||||
							
								
								
									
										38
									
								
								node_modules/vinyl-fs/lib/dest/sourcemap.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								node_modules/vinyl-fs/lib/dest/sourcemap.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var through = require('through2'); | ||||
| var sourcemap = require('vinyl-sourcemap'); | ||||
|  | ||||
| function sourcemapStream(optResolver) { | ||||
|  | ||||
|   function saveSourcemap(file, enc, callback) { | ||||
|     var self = this; | ||||
|  | ||||
|     var srcMap = optResolver.resolve('sourcemaps', file); | ||||
|  | ||||
|     if (!srcMap) { | ||||
|       return callback(null, file); | ||||
|     } | ||||
|  | ||||
|     var srcMapLocation = (typeof srcMap === 'string' ? srcMap : undefined); | ||||
|  | ||||
|     sourcemap.write(file, srcMapLocation, onWrite); | ||||
|  | ||||
|     function onWrite(sourcemapErr, updatedFile, sourcemapFile) { | ||||
|       if (sourcemapErr) { | ||||
|         return callback(sourcemapErr); | ||||
|       } | ||||
|  | ||||
|       self.push(updatedFile); | ||||
|       if (sourcemapFile) { | ||||
|         self.push(sourcemapFile); | ||||
|       } | ||||
|  | ||||
|       callback(); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   return through.obj(saveSourcemap); | ||||
| } | ||||
|  | ||||
| module.exports = sourcemapStream; | ||||
							
								
								
									
										59
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/index.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var through = require('through2'); | ||||
|  | ||||
| var writeDir = require('./write-dir'); | ||||
| var writeStream = require('./write-stream'); | ||||
| var writeBuffer = require('./write-buffer'); | ||||
| var writeSymbolicLink = require('./write-symbolic-link'); | ||||
|  | ||||
| var fo = require('../../file-operations'); | ||||
|  | ||||
| function writeContents(optResolver) { | ||||
|  | ||||
|   function writeFile(file, enc, callback) { | ||||
|     // Write it as a symlink | ||||
|     if (file.isSymbolic()) { | ||||
|       return writeSymbolicLink(file, optResolver, onWritten); | ||||
|     } | ||||
|  | ||||
|     // If directory then mkdirp it | ||||
|     if (file.isDirectory()) { | ||||
|       return writeDir(file, optResolver, onWritten); | ||||
|     } | ||||
|  | ||||
|     // Stream it to disk yo | ||||
|     if (file.isStream()) { | ||||
|       return writeStream(file, optResolver, onWritten); | ||||
|     } | ||||
|  | ||||
|     // Write it like normal | ||||
|     if (file.isBuffer()) { | ||||
|       return writeBuffer(file, optResolver, onWritten); | ||||
|     } | ||||
|  | ||||
|     // If no contents then do nothing | ||||
|     if (file.isNull()) { | ||||
|       return onWritten(); | ||||
|     } | ||||
|  | ||||
|     // This is invoked by the various writeXxx modules when they've finished | ||||
|     // writing the contents. | ||||
|     function onWritten(writeErr) { | ||||
|       var flags = fo.getFlags({ | ||||
|         overwrite: optResolver.resolve('overwrite', file), | ||||
|         append: optResolver.resolve('append', file), | ||||
|       }); | ||||
|       if (fo.isFatalOverwriteError(writeErr, flags)) { | ||||
|         return callback(writeErr); | ||||
|       } | ||||
|  | ||||
|       callback(null, file); | ||||
|     } | ||||
|  | ||||
|   } | ||||
|  | ||||
|   return through.obj(writeFile); | ||||
| } | ||||
|  | ||||
| module.exports = writeContents; | ||||
							
								
								
									
										31
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-buffer.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var fo = require('../../file-operations'); | ||||
|  | ||||
| function writeBuffer(file, optResolver, onWritten) { | ||||
|   var flags = fo.getFlags({ | ||||
|     overwrite: optResolver.resolve('overwrite', file), | ||||
|     append: optResolver.resolve('append', file), | ||||
|   }); | ||||
|   var opt = { | ||||
|     mode: file.stat.mode, | ||||
|     flags: flags, | ||||
|   }; | ||||
|  | ||||
|   fo.writeFile(file.path, file.contents, opt, onWriteFile); | ||||
|  | ||||
|   function onWriteFile(writeErr, fd) { | ||||
|     if (writeErr) { | ||||
|       return fo.closeFd(writeErr, fd, onWritten); | ||||
|     } | ||||
|  | ||||
|     fo.updateMetadata(fd, file, onUpdate); | ||||
|  | ||||
|     function onUpdate(updateErr) { | ||||
|       fo.closeFd(updateErr, fd, onWritten); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| } | ||||
|  | ||||
| module.exports = writeBuffer; | ||||
							
								
								
									
										51
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-dir.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,51 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var fs = require('graceful-fs'); | ||||
|  | ||||
| var mkdirp = require('fs-mkdirp-stream/mkdirp'); | ||||
|  | ||||
| var fo = require('../../file-operations'); | ||||
|  | ||||
| function writeDir(file, optResolver, onWritten) { | ||||
|   mkdirp(file.path, file.stat.mode, onMkdirp); | ||||
|  | ||||
|   function onMkdirp(mkdirpErr) { | ||||
|     if (mkdirpErr) { | ||||
|       return onWritten(mkdirpErr); | ||||
|     } | ||||
|  | ||||
|     fs.open(file.path, 'r', onOpen); | ||||
|   } | ||||
|  | ||||
|   function onOpen(openErr, fd) { | ||||
|     // If we don't have access, just move along | ||||
|     if (isInaccessible(openErr)) { | ||||
|       return fo.closeFd(null, fd, onWritten); | ||||
|     } | ||||
|  | ||||
|     if (openErr) { | ||||
|       return fo.closeFd(openErr, fd, onWritten); | ||||
|     } | ||||
|  | ||||
|     fo.updateMetadata(fd, file, onUpdate); | ||||
|  | ||||
|     function onUpdate(updateErr) { | ||||
|       fo.closeFd(updateErr, fd, onWritten); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| } | ||||
|  | ||||
| function isInaccessible(err) { | ||||
|   if (!err) { | ||||
|     return false; | ||||
|   } | ||||
|  | ||||
|   if (err.code === 'EACCES') { | ||||
|     return true; | ||||
|   } | ||||
|  | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| module.exports = writeDir; | ||||
							
								
								
									
										62
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-stream.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var fo = require('../../file-operations'); | ||||
| var readStream = require('../../src/read-contents/read-stream'); | ||||
|  | ||||
| function writeStream(file, optResolver, onWritten) { | ||||
|   var flags = fo.getFlags({ | ||||
|     overwrite: optResolver.resolve('overwrite', file), | ||||
|     append: optResolver.resolve('append', file), | ||||
|   }); | ||||
|   var opt = { | ||||
|     mode: file.stat.mode, | ||||
|     // TODO: need to test this | ||||
|     flags: flags, | ||||
|   }; | ||||
|  | ||||
|   // TODO: is this the best API? | ||||
|   var outStream = fo.createWriteStream(file.path, opt, onFlush); | ||||
|  | ||||
|   file.contents.once('error', onComplete); | ||||
|   outStream.once('error', onComplete); | ||||
|   outStream.once('finish', onComplete); | ||||
|  | ||||
|   // TODO: should this use a clone? | ||||
|   file.contents.pipe(outStream); | ||||
|  | ||||
|   function onComplete(streamErr) { | ||||
|     // Cleanup event handlers before closing | ||||
|     file.contents.removeListener('error', onComplete); | ||||
|     outStream.removeListener('error', onComplete); | ||||
|     outStream.removeListener('finish', onComplete); | ||||
|  | ||||
|     // Need to guarantee the fd is closed before forwarding the error | ||||
|     outStream.once('close', onClose); | ||||
|     outStream.end(); | ||||
|  | ||||
|     function onClose(closeErr) { | ||||
|       onWritten(streamErr || closeErr); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   // Cleanup | ||||
|   function onFlush(fd, callback) { | ||||
|     // TODO: removing this before readStream because it replaces the stream | ||||
|     file.contents.removeListener('error', onComplete); | ||||
|  | ||||
|     // TODO: this is doing sync stuff & the callback seems unnecessary | ||||
|     // TODO: Replace the contents stream or use a clone? | ||||
|     readStream(file, complete); | ||||
|  | ||||
|     function complete() { | ||||
|       if (typeof fd !== 'number') { | ||||
|         return callback(); | ||||
|       } | ||||
|  | ||||
|       fo.updateMetadata(fd, file, callback); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| } | ||||
|  | ||||
| module.exports = writeStream; | ||||
							
								
								
									
										77
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								node_modules/vinyl-fs/lib/dest/write-contents/write-symbolic-link.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,77 @@ | ||||
| 'use strict'; | ||||
|  | ||||
| var os = require('os'); | ||||
| var path = require('path'); | ||||
|  | ||||
| var fo = require('../../file-operations'); | ||||
|  | ||||
| var isWindows = (os.platform() === 'win32'); | ||||
|  | ||||
| function writeSymbolicLink(file, optResolver, onWritten) { | ||||
|   if (!file.symlink) { | ||||
|     return onWritten(new Error('Missing symlink property on symbolic vinyl')); | ||||
|   } | ||||
|  | ||||
|   var isRelative = optResolver.resolve('relativeSymlinks', file); | ||||
|   var flags = fo.getFlags({ | ||||
|     overwrite: optResolver.resolve('overwrite', file), | ||||
|     append: optResolver.resolve('append', file), | ||||
|   }); | ||||
|  | ||||
|   if (!isWindows) { | ||||
|     // On non-Windows, just use 'file' | ||||
|     return createLinkWithType('file'); | ||||
|   } | ||||
|  | ||||
|   fo.reflectStat(file.symlink, file, onReflect); | ||||
|  | ||||
|   function onReflect(statErr) { | ||||
|     if (statErr && statErr.code !== 'ENOENT') { | ||||
|       return onWritten(statErr); | ||||
|     } | ||||
|  | ||||
|     // This option provides a way to create a Junction instead of a | ||||
|     // Directory symlink on Windows. This comes with the following caveats: | ||||
|     // * NTFS Junctions cannot be relative. | ||||
|     // * NTFS Junctions MUST be directories. | ||||
|     // * NTFS Junctions must be on the same file system. | ||||
|     // * Most products CANNOT detect a directory is a Junction: | ||||
|     //    This has the side effect of possibly having a whole directory | ||||
|     //    deleted when a product is deleting the Junction directory. | ||||
|     //    For example, JetBrains product lines will delete the entire contents | ||||
|     //    of the TARGET directory because the product does not realize it's | ||||
|     //    a symlink as the JVM and Node return false for isSymlink. | ||||
|  | ||||
|     // This function is Windows only, so we don't need to check again | ||||
|     var useJunctions = optResolver.resolve('useJunctions', file); | ||||
|  | ||||
|     var dirType = useJunctions ? 'junction' : 'dir'; | ||||
|     // Dangling links are always 'file' | ||||
|     var type = !statErr && file.isDirectory() ? dirType : 'file'; | ||||
|  | ||||
|     createLinkWithType(type); | ||||
|   } | ||||
|  | ||||
|   function createLinkWithType(type) { | ||||
|     // This is done after prepare() to use the adjusted file.base property | ||||
|     if (isRelative && type !== 'junction') { | ||||
|       file.symlink = path.relative(file.base, file.symlink); | ||||
|     } | ||||
|  | ||||
|     var opts = { | ||||
|       flags: flags, | ||||
|       type: type, | ||||
|     }; | ||||
|     fo.symlink(file.symlink, file.path, opts, onSymlink); | ||||
|  | ||||
|     function onSymlink(symlinkErr) { | ||||
|       if (symlinkErr) { | ||||
|         return onWritten(symlinkErr); | ||||
|       } | ||||
|  | ||||
|       fo.reflectLinkStat(file.path, file, onWritten); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|  | ||||
| module.exports = writeSymbolicLink; | ||||
		Reference in New Issue
	
	Block a user