gulp

Compile client-side Jade templates using Gulpjs

别来无恙 提交于 2019-12-07 09:40:07
问题 I'm trying to compile all my .jade templates into a single js file, I'm using Gulpjs and gulp-jade, gulp-concat.. I can get the single file but the problem is that all the functions rendered there have the same name, they are all called "template". foo.jade: .fooDiv h1 Foo here foo2.jade: .foo2Div h1 Foo2 here Gulp file: gulp.src("templates/**/*.jade") .pipe(jade({client: true})) .pipe(concat("templates.js")) .pipe(gulp.dest("../website/templates")) That would output a file like this:

run-sequence doesn't run gulp tasks in order

梦想的初衷 提交于 2019-12-07 09:17:52
问题 I have 3 tasks in my Gulp file that must run in this order: clean (deletes everything in the /dist folder) copy (copies multiple files into the /dist folder) replace (replaces some strings in some files in the /dist folder) I've read all the other posts, I've tried "run-sequence" but it's not working as the "replace" task isn't running last. I'm confused by the use of "callback". Running the tasks individually works fine. var gulp = require('gulp'); var runSequence = require('run-sequence');

Gulp-Sourcemaps, SyntaxError: Unexpected token >

六月ゝ 毕业季﹏ 提交于 2019-12-07 08:22:23
问题 Gulp / npm noobie here. I'm trying to use gulp-sourcemaps, and for some reason, it crashes on var sourcemaps = require('sourcemaps') .(It crash only when this line's in the file) gulpfile: var gulp = require('gulp'); var uglify = require('gulp-uglify'); var concat = require('gulp-concat'); var sourcemaps = require('gulp-sourcemaps'); gulp.task('generateApp', function () { return gulp.src([some paths...]) .pipe(sourcemaps.init()) .pipe(concat('app.min.js')) .pipe(uglify()) .pipe(sourcemaps

Can you use subdirectories within Jekyll's _includes folder?

99封情书 提交于 2019-12-07 06:22:44
问题 My plan is to have folders within the _includes directory: _includes/footers _includes/heros _includes/cta etc... When I reference that {% include footers/footer1.html %} I get the following error: Liquid Exception: Included file '_includes/footers/footer1.html' not found in _layouts/default.html Is this outside the intended functionality, or am I missing something? 回答1: Yes you can nest partials. Subdirectories don't have to be prepended with an underscore. Let's say you have a footers

Node (Gulp) process.stdout.write to file

核能气质少年 提交于 2019-12-07 06:08:46
问题 I'm trying to have gulp taking care of my unit tests for me, and outputting my test coverage to a .lcov file. This is what I have so far : gulp.task('test', function () { var test = fs.createWriteStream('./test.lcov', {flags: 'a'}); return gulp.src('./assets/js/test/test.js', {read: false}) .pipe(mocha({reporter: 'mocha-lcov-reporter'})) .pipe(test); }); The mocha-lcov-reporter code can be found here : https://github.com/StevenLooman/mocha-lcov-reporter/blob/master/lib/lcov.js It outputs

Execute Gulp.js tasks post build in VS2015

六眼飞鱼酱① 提交于 2019-12-07 05:55:50
问题 I have a basic Asp.Net 5 site which used Gulp.JS tasks to clean, copy and minify CSS and JS files. When running these tasks in the Task Runner Explorer - all is good and the old scripts are removed, new ones copied and files minified. I wish to automate these tasks in VS2015 - so when I build the project the following will happen: Old scripts are removed using the clean taks New scripts are copied over - using the copy task CSS and JS are minified using a min taks (will minify CSS and JS by

How do i go to parent directory when using __dirname?

蹲街弑〆低调 提交于 2019-12-07 05:30:10
问题 Directory structure : WebApiRole GulpFile.js test Karma.conf.js Gulp code from GulpFile.js gulp.task('test', function (done) { karma.start({ configFile: _configFile: __dirname + '\\..\\test\\karma.conf.js', singleRun: true }, done); }); So my problem going to the parent directory and access the karma.conf.js . For some reason the path is not get resolved with ..\\ to go back to the parent directory of WebApiRole . can someone point me in the right direction ? 回答1: I had to use path package to

Migrate gulp.start function to Gulp v4

£可爱£侵袭症+ 提交于 2019-12-07 05:05:52
问题 I have been migrating all of my gulp v3 code bases into v4. However I'm stuck at a point where I have gulp start function and it throws me an error when I run gulp start in gulp v4. This is the function I had in version 3: gulp.task('default', ['watch'], function () { gulp.start('styles', 'scripts', 'images'); }); When migrating to v4 of gulp I implemented this function: gulp.task('default', gulp.parallel('watch', function(done) { gulp.start('styles', 'scripts', 'images'); done(); })); How to

Windows Error Deleting node_modules Folder: Source Path Too Long

你。 提交于 2019-12-07 04:50:16
问题 I've made the switch to use npm/gulp in Visual Studio on Windows. However, removing the associated files has been painful in that I cannot easily delete the node_modules folder. When trying to delete a folder hierarchy for a solution using Windows Explorer, I get the following "Source Path Too Long" dialog: From there, I've tried using the Windows command prompt to delete using rmdir /s /q node_modules which may or may not work. When it doesn't work, the errors look something like (snip) ~1

ES6 unit testing without compilation

余生长醉 提交于 2019-12-07 04:03:58
问题 I'm not able to find any examples of Mocha or any other unit test framework running directly on ES6 code via Gulp. (No Babel, Webpack, etc.) I've tracked down one example of Mocha (with some modification) running in a browser on ES6 code, but it was not automated. Is anyone testing ES6 code directly yet? (I understand this isn't the 'proper' format of an SO question, but I'm in the 'where do I start' phase here.) 回答1: Mocha runs tests in Node.js, therefore you can use and test any es6 feature