gulp

why am i getting this error? dest.on is not a function - using gulp-file-include

折月煮酒 提交于 2019-12-23 06:45:07
问题 I am getting an Error of TypeError: dest.on is not a function . When running this task, I can't figure out what could be wrong. var fileinclude = require('gulp-file-include'); var rename = require('gulp-rename'); var paths = { templates : './templates/' } //file include: grab partials from templates and render out html files gulp.task('fileinclude', function() { return gulp.src(paths.templates + '*.tpl.html') .pipe(fileinclude) .pipe(rename({ extname: "" })) .pipe(rename({ extname: ".html" })

gulp.watch tasks not picking up changed files

十年热恋 提交于 2019-12-23 05:12:33
问题 I have a gulp css task that picks up a CSS file and runs several postCSS processors on it, then writes the file to a destination directory. I have an html task that uses gulp-smoosher to pull the CSS file into the HTML file, replacing the link tag to the CSS file. When I run the tasks separately from the command line, everything works as expected. However, when I use gulp.watch to automatically run the tasks when the CSS file changes, the changes aren't reflected in the final HTML file. Is

Nunjucks dynamic page template

只愿长相守 提交于 2019-12-23 04:32:33
问题 i'm using nunjucks (gulp) as templating language and i want to build a dynamic page template. This is my Json: "pages": [ { uname: "Welcome", title: "Page 1 Headline" }, { uname: "About", title: "Page 2 Headline" } ] Currently i have a static page (html) template for each page: {% extends "layout.html" %} {% set active_page = "Welcome" %} //<- This needs to be dynamicly {% block content %} <h1>{{ page[0].title }}</h1> //<- This needs to be dynamicly My first thought was to read the url

Vinyl-ftp strange error

泄露秘密 提交于 2019-12-23 03:36:37
问题 I am using Vinyl-ftp to do deployment, when i try to connect with FileZilla or Total Commander everything works ok, but when i try wirh Gulp task i got strange error, i dont see the difference, here is my Gulp task and error message gulp.task('ftp-test-connection', function () { var conn = ftp.create({ host: 'hostname', user: 'user', password: 'password', parallel: 10, log: gutil.log }); var globs = [ './styles/**/*{css,png,jpg,gif,ttf,woff,eof,svg,woff2}', './images/**', './views/**', '.

Vinyl-ftp strange error

落花浮王杯 提交于 2019-12-23 03:36:07
问题 I am using Vinyl-ftp to do deployment, when i try to connect with FileZilla or Total Commander everything works ok, but when i try wirh Gulp task i got strange error, i dont see the difference, here is my Gulp task and error message gulp.task('ftp-test-connection', function () { var conn = ftp.create({ host: 'hostname', user: 'user', password: 'password', parallel: 10, log: gutil.log }); var globs = [ './styles/**/*{css,png,jpg,gif,ttf,woff,eof,svg,woff2}', './images/**', './views/**', '.

How to run a Gulp task with a keyboard shortcut

和自甴很熟 提交于 2019-12-23 03:30:07
问题 I want to run the default Gulp task with VS code by using the inbuilt feature to do so. My tasks.json is as follows: { "version": "2.0.0", "tasks": [ { "type": "gulp", "task": "default", "problemMatcher": [] } ] } When I run the task with the keyboard shortcut(my keybindings are already modified to run the task), I get an options menu with all the list of the Gulp tasks. To actually run the gulp command, I have to select the 'gulp:default' task from the list. How can I run the task without

Cache busting: append query string or rename file?

*爱你&永不变心* 提交于 2019-12-23 02:36:41
问题 When we try to break static assets caches, there are two common ways to doing that: By appending query string like assets/file.ext?v=123abc By renaming files like assets/file.123abc.ext However after days of searching, I found that most of building tools prefer to renaming files, e.g. gulp-rev. In my view this kind of revision will generates lots of file chunks on the server: assets |_ file.a.ext |_ file.b.ext |_ file.c.ext |_ file.d.ext |... Any idea about this? 回答1: After days of searching,

gulp-nunjucks-html + gulp-data not compiling on watch

£可爱£侵袭症+ 提交于 2019-12-23 02:06:12
问题 I've written a gulp task to take data from json files and process it as html. When I first run the build this works like a charm, however I've set up a watch task to also do this and although it will rebuild the nunjucks file into html, it seems to ignore the json until the next full build (even though all the watch does is run the same task) here is my task: // Process nunjucks html files (.nunjucks) gulp.task('nunjucks', function() { 'use strict'; return gulp.src('src/html/pages/**/*

gulp-nunjucks-html + gulp-data not compiling on watch

一个人想着一个人 提交于 2019-12-23 02:06:11
问题 I've written a gulp task to take data from json files and process it as html. When I first run the build this works like a charm, however I've set up a watch task to also do this and although it will rebuild the nunjucks file into html, it seems to ignore the json until the next full build (even though all the watch does is run the same task) here is my task: // Process nunjucks html files (.nunjucks) gulp.task('nunjucks', function() { 'use strict'; return gulp.src('src/html/pages/**/*

Require another file in gulpfile (which isn't in node_modules)

六月ゝ 毕业季﹏ 提交于 2019-12-23 01:41:45
问题 I've been using gulp for a while now and know how to import another node module, e.g. var sass = require('gulp-sass'); That's fine, but my gulpfile is filling up with code that I'd like to move into a separate file and "require". Specifically I am writing a postcss plugin, which I already have working when declared as a function inside of the gulpfile. My question is how to put my function in an external file and require it like I do a node module. Do I need to "export" the function in the