gulp

How to run gulp tasks from a node script

喜你入骨 提交于 2019-12-04 09:54:37
问题 I have a node script and I want to run a gulp task I have in the same script, how can I call it? #!/usr/bin/env node var gulp = require('gulp'); gulp.task('default', function (arg) { }); // How do I call the task 'default' 回答1: Eventually I found the way: gulp.start('default'); 回答2: Use an array in start method, in the case someone is looking for a way of running multiple tasks from search engines. gulp.start( [ 'task1', 'task2' ] ); 来源: https://stackoverflow.com/questions/28481020/how-to-run

Can I set gulp livereload to run after all files are compiled?

吃可爱长大的小学妹 提交于 2019-12-04 09:21:24
I've got a gulp set up to work with Stylus, Jade and tiny-lr. My problem is that when I save one jade file, it start's compiling them all, therefore live reloading fires on the first file copied to the destination, before the file I am working on currently is compiled, resulting in me having to refresh manually. I have fixing this issue using "gulp-changed" but I don't seem to be able to configure it or something. Anyone had this problem before? I am posting my Gulp file so you can take a look. A timeline diagram of the problem can be found here: https://www.dropbox.com/s/3g37oy25s9mq969/jade

Get relative path of the file for tasks in vscode

 ̄綄美尐妖づ 提交于 2019-12-04 09:17:17
I have a task defined in vscode's tasks.json file as following { "version": "0.1.0", "tasks": [ { "command": "gulp", "taskName": "eslint_task", "args": [ "eslint", "--file", "${file}" ], "echoCommand": true } ] } The ${file} is providing me the absolute path (starting from /Volumes in macOS) of the file on which I run this command. Is there any way I can get the relative path (Path starting from the workspace folder) of the same file instead? I already checked the official documentation for tasks , but couldn't find any list of arguments there. Found the answer. I just need to use $

Using variables in Gulp for the destination file name?

扶醉桌前 提交于 2019-12-04 09:14:13
问题 I am new to gulp and I am wondering if what I want to achieve is practical or possible. My projects structure: root | components | | | component_1 | | styles.scss | | actions.js | | template.html | | ... | component_2 | | styles.scss | | template.html | | ... | public | assets | css (dest) | component_1.css | component_2.css | ... js (dest) Now what I want is that Gulp stores the compiled css files in the according css folder in public/assets but uses the name of folder where it found the

javascript, gulp, watch, changed

点点圈 提交于 2019-12-04 09:03:34
I cannot get my head around this. This is supposed to be a gulp task that is executed every time a watched file is modified. Can anyone explain why it is required to pipe the watched files through the changed plugin? gulp.task('build-css', function () { return gulp.src(paths.css) .pipe(changed(paths.output, {extension: '.css'})) .pipe(gulp.dest(paths.output)); }); gulp.task('watch', ['serve'], function() { gulp.watch(paths.css, ['build-css']); }); Disclaimer: this is not my code. Just trying to understand what is going on, in order to create my own custom watch task. The difference between

Gulp watch and compile less files with @import

放肆的年华 提交于 2019-12-04 09:00:46
问题 I'm trying to get my head around gulp to watch and compile a .less project + livereload. I have a style.less file which use @import . When i run the gulp task it doesn't seem to understand the imports. When I modify the main less file, gulp compiles the file and refresh the browser but if i modify only an import, the changes are ignored. Here is my gulpfile.js var gulp = require('gulp'); var less = require('gulp-less'); var watch = require('gulp-watch'); var prefix = require('gulp

'gulp' is not recognized as an internal or external command

痴心易碎 提交于 2019-12-04 08:49:30
问题 I am trying to use Gulp and Node.Js to stream my process for minifying and concatenating CSS/JS files for production. Here is what I have done. I installed Node.Js on my Windows 7 machine. Installed Gulp globally using this command npm install -g gulp Then I added a new User variable called NODE_PATH set it to %AppData%\npm\node_modules After closing and re-opening my command line, I tried to run a gulp task from the command line (i.e. gulp css ). But that give me the following error 'gulp'

Have sass-lint ignore a certain line?

扶醉桌前 提交于 2019-12-04 08:48:54
问题 I'm using sass -lint with Gulp. How can I disable warnings for a particular style in my sass from the lint console output? I've found a similar question but I'm using sass -lint, not scss -lint: Having scss-lint ignore a particular line This is the one I'm using: https://www.npmjs.com/package/gulp-sass-lint I've tried a few variations based off of the scss -lint project: // scss-lint:disable ImportantRule // sass-lint:disable ImportantRule // sass-lint:disable no-important Just to be clear, I

CNPM搭建私有的NPM服务

北慕城南 提交于 2019-12-04 08:25:14
从零开始nodejs系列文章 ,将介绍如何利Javascript做为服务端脚本,通过Nodejs框架web开发。Nodejs框架是基于V8的引擎,是目前速度最快的Javascript引擎。chrome浏览器就基于V8,同时打开20-30个网页都很流畅。Nodejs标准的web开发框架Express,可以帮助我们迅速建立web站点,比起PHP的开发效率更高,而且学习曲线更低。非常适合小型网站,个性化网站,我们自己的Geek网站!! 关于作者 张丹(Conan), 程序员Java,R,PHP,Javascript weibo:@Conan_Z blog: http://blog.fens.me email: bsspirit@gmail.com 转载请注明出处: http://blog.fens.me/nodejs-cnpm-npm/ 前言 随着Nodejs开发的项目越来越多,Node项目管理就成了一个需要思考的问题了。如果所有项目都开源统一用 NPM 进行管理也没什么问题,但总有一些是我们不希望的完全开放的代码,作为企业是核心秘密保留在公司内部,这个时候就需要在公司内网也搭建一套 NPM 依赖管理系统。 CNPM正好就提供了这个功能。从Github上CNPM的主页看,CNPM由国内Alibaba团队开发维护。 目录 CNPM是什么? 搭建CNPM的服务器 设置私有注册库的三种方法

Nodemon watch option broken

末鹿安然 提交于 2019-12-04 08:21:51
I am using gulp-nodemon config directory includes only one file, server.js. $.nodemon({ script: 'config/server.js', watch: ['config/**/*.js'] }) .on('restart', function () { setTimeout(function () { $.livereload.changed(); }, 1000); }); Output: [gulp] [nodemon] v1.2.1 [gulp] [nodemon] to restart at any time, enter `rs` [gulp] [nodemon] watching: config/**/*.js [gulp] [nodemon] starting `node config/server.js` [gulp] [nodemon] watching 34,325 files - this might cause high cpu usage. To reduce use "--watch". If i include an ignore option it fixes. ignore: [ 'node_modules/**', 'bower_components/*