blog menu page & blog article page
This commit is contained in:
6
node_modules/gulp-copy/.eslintrc
generated
vendored
Normal file
6
node_modules/gulp-copy/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "./node_modules/js-styleguide/.eslintrc",
|
||||
"rules": {
|
||||
"no-magic-numbers": 0
|
||||
}
|
||||
}
|
||||
5
node_modules/gulp-copy/.npmignore
generated
vendored
Normal file
5
node_modules/gulp-copy/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
node_modules
|
||||
.idea
|
||||
example/output
|
||||
test/coverage
|
||||
test/junit
|
||||
15
node_modules/gulp-copy/CHANGELOG.md
generated
vendored
Normal file
15
node_modules/gulp-copy/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
## 1.0.1
|
||||
* Fix for absolute paths
|
||||
|
||||
## 1.0.0
|
||||
* Require node v4
|
||||
* Require gulp 3.9.x
|
||||
* Automated tests
|
||||
|
||||
## 0.0.2 Streams release
|
||||
* use nodejs streams to write files (instead of cp command)
|
||||
* fix callback issues (which probably will fix the too many open files bug)
|
||||
|
||||
## 0.0.1 Initial release
|
||||
* initial code
|
||||
20
node_modules/gulp-copy/LICENSE
generated
vendored
Normal file
20
node_modules/gulp-copy/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Klaas Cuvelier
|
||||
|
||||
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.
|
||||
34
node_modules/gulp-copy/README.md
generated
vendored
Normal file
34
node_modules/gulp-copy/README.md
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
[](https://www.npmjs.com/package/gulp-copy)
|
||||
[](https://circleci.com/gh/klaascuvelier/gulp-copy/)
|
||||
|
||||
# gulp-copy
|
||||
|
||||
Copy source files to new destination and use that destination as new source (for further piping).
|
||||
Automatically creates needed folders before proceeding. Ability to remove 'prefixes' from path.
|
||||
|
||||
Most likely you don't need this package for your gulp pipeline, a lot can be accomplished with just `gulp.dest`.
|
||||
A reason to use this package would be to keep some depth (prefix options).
|
||||
|
||||
## Usage
|
||||
```
|
||||
// gulpfile.js
|
||||
|
||||
var gulpCopy = require('gulp-copy');
|
||||
var otherGulpFunction = require('gulp-other-function');
|
||||
var sourceFiles = [ 'source1/*', 'source2/*.txt' ];
|
||||
var destination = 'dest/';
|
||||
|
||||
return gulp
|
||||
.src(sourceFiles)
|
||||
.pipe(gulpCopy(outputPath, options))
|
||||
.pipe(otherGulpFunction())
|
||||
.dest(destination);
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
`prefix`: integer, defining how many parts of the path (separated by /) should be removed from the original path
|
||||
|
||||
## Updates
|
||||
|
||||
See [changelog](CHANGELOG.md) for all updates.
|
||||
1
node_modules/gulp-copy/example/files/test-2.txt
generated
vendored
Normal file
1
node_modules/gulp-copy/example/files/test-2.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
a 2nd test
|
||||
1
node_modules/gulp-copy/example/files/test.txt
generated
vendored
Normal file
1
node_modules/gulp-copy/example/files/test.txt
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
some file
|
||||
31
node_modules/gulp-copy/example/gulpfile.js
generated
vendored
Normal file
31
node_modules/gulp-copy/example/gulpfile.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
var copy = require('../index');
|
||||
var gulp = require('gulp');
|
||||
var through = require('through2');
|
||||
|
||||
gulp.task('default', copyFunction);
|
||||
|
||||
function copyFunction ()
|
||||
{
|
||||
return gulp
|
||||
.src([' ./files/.*', './files/*.*' ])
|
||||
.pipe(copy('output/test', { prefix: 1 }))
|
||||
.pipe(verify());
|
||||
}
|
||||
|
||||
function verify ()
|
||||
{
|
||||
var options = { objectMode: true };
|
||||
return through(options, write, end);
|
||||
|
||||
function write (file, enc, cb)
|
||||
{
|
||||
console.log('file', file.path);
|
||||
cb(null, file);
|
||||
}
|
||||
|
||||
function end (cb)
|
||||
{
|
||||
console.log('done');
|
||||
cb();
|
||||
}
|
||||
}
|
||||
3
node_modules/gulp-copy/index.js
generated
vendored
Normal file
3
node_modules/gulp-copy/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./lib/gulp-copy');
|
||||
169
node_modules/gulp-copy/lib/gulp-copy.js
generated
vendored
Normal file
169
node_modules/gulp-copy/lib/gulp-copy.js
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
'use strict';
|
||||
|
||||
var through = require('through2');
|
||||
var path = require('path');
|
||||
var fs = require('fs');
|
||||
var PluginError = require('gulp-util').PluginError;
|
||||
|
||||
/**
|
||||
* gulp copy method
|
||||
* @param {string} destination
|
||||
* @param {object} opts
|
||||
* @returns {object}
|
||||
*/
|
||||
function gulpCopy (destination, opts)
|
||||
{
|
||||
var throughOptions = { objectMode: true };
|
||||
|
||||
// Make sure a destination was verified
|
||||
if (typeof destination !== 'string') {
|
||||
throw new PluginError('gulp-copy', 'No valid destination specified');
|
||||
}
|
||||
|
||||
// Default options
|
||||
if (opts === undefined) {
|
||||
opts = opts || {};
|
||||
}
|
||||
else if (typeof opts !== 'object' || opts === null) {
|
||||
throw new PluginError('gulp-copy', 'No valid options specified');
|
||||
}
|
||||
|
||||
return through(throughOptions, transform);
|
||||
|
||||
/**
|
||||
* Transform method, copies the file to its new destination
|
||||
* @param {object} file
|
||||
* @param {string} encoding
|
||||
* @param {function} cb
|
||||
*/
|
||||
function transform(file, encoding, cb)
|
||||
{
|
||||
var rel = null;
|
||||
var fileDestination = null;
|
||||
|
||||
if (file.isStream()) {
|
||||
return cb(new PluginError('gulp-copy', 'Streaming not supported'));
|
||||
}
|
||||
|
||||
if (!file.isNull()) {
|
||||
rel = path.relative(file.cwd, file.path).replace(/\\/g, '/');
|
||||
|
||||
// Strip path prefixes
|
||||
if (opts.prefix) {
|
||||
var p = opts.prefix;
|
||||
while (p-- > 0) {
|
||||
rel = rel.substring(rel.indexOf('/') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
fileDestination = destination + '/' + rel;
|
||||
|
||||
// Make sure destination exists
|
||||
if (!doesPathExist(fileDestination)) {
|
||||
createDestination(fileDestination.substr(0, fileDestination.lastIndexOf('/')));
|
||||
}
|
||||
|
||||
// Copy the file
|
||||
copyFile(file.path, fileDestination, function (error) {
|
||||
if (error) {
|
||||
throw new PluginError('gulp-copy', 'Could not copy file <' + file.path + '>: ' + error.message);
|
||||
}
|
||||
|
||||
// Update path for file so this path is used later on
|
||||
file.path = fileDestination;
|
||||
cb(null, file);
|
||||
});
|
||||
}
|
||||
else {
|
||||
cb(null, file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively creates the path
|
||||
* @param {string} destination
|
||||
*/
|
||||
function createDestination(destination)
|
||||
{
|
||||
var folders = destination.split('/');
|
||||
var path = [];
|
||||
var l = folders.length;
|
||||
var i = 0;
|
||||
|
||||
// for absolute paths
|
||||
if (folders[0] === '') {
|
||||
path.push('/');
|
||||
folders.shift();
|
||||
}
|
||||
|
||||
for (i; i < l; i++) {
|
||||
path.push(folders[i]);
|
||||
|
||||
if (folders[i] !== '' && !doesPathExist(path.join('/'))) {
|
||||
try {
|
||||
fs.mkdirSync(path.join('/'));
|
||||
} catch (error) {
|
||||
throw new PluginError(
|
||||
'gulp-copy',
|
||||
'Could not create destination <' + destination + '>: ' + error.message
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the path exists
|
||||
* @param path
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function doesPathExist (path)
|
||||
{
|
||||
var pathExists = true;
|
||||
|
||||
try {
|
||||
fs.accessSync(path);
|
||||
}
|
||||
catch (error) {
|
||||
pathExists = false;
|
||||
}
|
||||
|
||||
return pathExists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file to its new destination
|
||||
* @param {string} source
|
||||
* @param {string} target
|
||||
* @param {function} copyCallback
|
||||
*/
|
||||
function copyFile (source, target, copyCallback)
|
||||
{
|
||||
var done = false;
|
||||
var readStream = fs.createReadStream(source);
|
||||
var writeStream = fs.createWriteStream(target);
|
||||
|
||||
readStream.on('error', copyDone);
|
||||
writeStream.on('error', copyDone);
|
||||
|
||||
writeStream.on('close', function() {
|
||||
copyDone(null);
|
||||
});
|
||||
|
||||
readStream.pipe(writeStream);
|
||||
|
||||
/**
|
||||
* Finish copying. Reports error when needed
|
||||
* @param [error] optional error
|
||||
*/
|
||||
function copyDone (error)
|
||||
{
|
||||
if (!done) {
|
||||
done = true;
|
||||
copyCallback(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = gulpCopy;
|
||||
64
node_modules/gulp-copy/package.json
generated
vendored
Normal file
64
node_modules/gulp-copy/package.json
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"_from": "gulp-copy@^1.0.1",
|
||||
"_id": "gulp-copy@1.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-uhIdHo9SoWkf+pjfjETOMD/6ez10ZItO5/L1bFRfVGH+7lq9zE3TSjkh3WVPuTS9ttPRHA7yW4g1QRE1hPwUOA==",
|
||||
"_location": "/gulp-copy",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "gulp-copy@^1.0.1",
|
||||
"name": "gulp-copy",
|
||||
"escapedName": "gulp-copy",
|
||||
"rawSpec": "^1.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#DEV:/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/gulp-copy/-/gulp-copy-1.0.1.tgz",
|
||||
"_shasum": "f7773bdb801be4c8f9123b575b8f33ba7db1f9df",
|
||||
"_spec": "gulp-copy@^1.0.1",
|
||||
"_where": "/Users/nina/Documents/Projects/saburly-website2",
|
||||
"author": {
|
||||
"name": "Klaas Cuvelier",
|
||||
"email": "cuvelierklaas@gmail.com",
|
||||
"url": "http://klaascuvelier.io"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/klaascuvelier/gulp-copy/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-util": "^3.0.8",
|
||||
"through2": "^2.0.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Plugin copying files to a new destination and using that destination for other actions",
|
||||
"devDependencies": {
|
||||
"eslint": "^4.4.1",
|
||||
"jasmine-node": "^1.14.5",
|
||||
"js-styleguide": "git://github.com/klaascuvelier/js-styleguide.git#master"
|
||||
},
|
||||
"homepage": "https://github.com/klaascuvelier/gulp-copy",
|
||||
"keywords": [
|
||||
"gulpplugin",
|
||||
"copy",
|
||||
"gulp"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "gulp-copy",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/klaascuvelier/gulp-copy.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint ./lib -c ./.eslintrc",
|
||||
"test": "jasmine-node test/spec"
|
||||
},
|
||||
"version": "1.0.1"
|
||||
}
|
||||
23
node_modules/gulp-copy/test/spec/gulp-copy.spec.js
generated
vendored
Normal file
23
node_modules/gulp-copy/test/spec/gulp-copy.spec.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
describe('Gulp Copy', function () {
|
||||
|
||||
var gulpCopy = require('../../lib/gulp-copy');
|
||||
|
||||
it('should exist', function () {
|
||||
expect(gulpCopy).toBeDefined();
|
||||
});
|
||||
|
||||
it('should require a valid destination', function () {
|
||||
expect(function () { gulpCopy() }).toThrow();
|
||||
expect(function () { gulpCopy(null) }).toThrow();
|
||||
expect(function () { gulpCopy(1) }).toThrow();
|
||||
expect(function () { gulpCopy('') }).not.toThrow();
|
||||
});
|
||||
|
||||
it('should require a valid options object', function () {
|
||||
expect(function () { gulpCopy('', 1) }).toThrow();
|
||||
expect(function () { gulpCopy('') }).not.toThrow();
|
||||
expect(function () { gulpCopy('', {}) }).not.toThrow();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user