gulp

Gulp error in WebStorm: Failed to list gulp tasks

匿名 (未验证) 提交于 2019-12-03 00:34:01
I have the same problem with webstorm after install a updated version of node. The solution for me is the following: In the block Gulp where webstorm show the list of task , click the cog icon and select gulp settings , in the section "Gulp package" add the path to the local gulp package (the gulp inside the node_modules in your project). Example of path: yourproject\node_modules\gulp Another way that would probably solve the problem is to remove the node_modules folder and run npm install again. You must have your dependencies registered in the package.json file Gulp error in WebStorm: Failed

NPM下载模块说明

匿名 (未验证) 提交于 2019-12-03 00:21:02
我们以用npm下载gulp 的为例 1 首先确保你已经正确安装了 nodejs 环境。然后以全局方式安装 gulp : npm install -g gulp 2 全局安装 gulp 后,还需要在每个要使用 gulp 的项目中都单独安装一次。把目录切换到你的项目文件夹中,然后在命令行中执行: npm install gulp 3 如果想在安装的时候把 gulp 写进项目 package.json 文件的依赖中,则可以加上 --save-dev : npm install--save-dev gulp 这样就完成了 gulp 的安装。至于为什么在全局安装 gulp 后,还需要在项目中本地安装一次,有兴趣的可以看下 stackoverflow 上有人做出的回答: why-do-we-need-to-install-gulp-globally-and-locally 、 what-is-the-point-of-double-install-in-gulp 。大体就是为了版本的灵活性,但如果没理解那也不必太去纠结这个问题,只需要知道通常我们是要这样做就行了。 文章来源: NPM下载模块说明

通用版gulp

匿名 (未验证) 提交于 2019-12-03 00:03:02
gulpfile.js内容 const gulp = require('gulp'); // 压缩css文件 const cssmin = require('gulp-clean-css'); // 压缩html,可以压缩页面javascript、css,去除页面空格、注释,删除多余属性等操作 const htmlmin = require('gulp-htmlmin'); // 只操作有过修改的文件 const changed = require('gulp-changed'); // 压缩javascript文件,减小文件大小 const uglify = require('gulp-uglify'); // 文件清理 const clean = require('gulp-clean'); // es6תes5 const babel = require('gulp-babel'); // 加版本号 const assetRev = require('gulp-asset-rev'); // 使用gulp-htmlmin压缩html gulp.task('htmlminTask', function () { var options = { removeComments: true, // 清除HTML注释 collapseWhitespace: true, //

gulp添加版本号解决缓存问题

匿名 (未验证) 提交于 2019-12-03 00:03:02
解决缓存问题,发布前添加版本号 文件夹结构 const gulp = require('gulp'); // 文件清理 const clean = require('gulp-clean'); // 加版本号 const assetRev = require('gulp-asset-rev'); // 使用gulp-htmlmin压缩html gulp.task('htmlminTask', function() { gulp.src('src/*.html') //创建一个流,用于从文件系统读取 Vinyl 对象 .pipe(assetRev()) //管道方法 .pipe(gulp.dest('dist/')) //创建一个用于将 Vinyl 对象写入到文件系统的流 gulp.src('src/index.html') .pipe(assetRev()) .pipe(gulp.dest('dist/')) gulp.src(['src/**/*.html']) .pipe(assetRev()) .pipe(gulp.dest('dist/')) }) // 文件复制 gulp.task('copyTask', function() { gulp.src('src/asset/css/**/*') .pipe(gulp.dest('dist/asset/css/')) gulp

gulp基础

匿名 (未验证) 提交于 2019-12-02 23:55:01
一、什么是gulp?   (一)gulp是前端项目的自动化构建工具 二、gulp的作用   (一)常用的gulp插件     1、压缩JS     2、合并文件     3、重命名文件     4、编译sass     5、压缩css     6、压缩图片 三、gulp依赖的运行环境: node.js 四、安装node.js并测试是否安装成功 五、全局安装gulp:npm install -g gulp@3 注:以下操作都必须在项目的根目录下进行操作: 六、初始化package.json文件:npm init [-y] 七、创建gulpfile.js   (一)局部安装     1、安装所需插件:npm install --save-dev 插件名     2、如:         gulp         gulp-uglify         gulp-rename         gulp-concat     3、在gulpfile.js中配置       a、通过require导入所需插件                 const gulp = require('gulp'),         uglify = require('gulp-uglify'),         rename = require('gulp-rename'),         concat

gulp: where is the gulp task callback function defined?

落爺英雄遲暮 提交于 2019-12-02 23:43:41
A task in gulp can be defined like so: gulp.task('foobar', function(callback) { ... }); I'm trying to understand what the callback function is. Where is it defined? Can I pass in some other function as an argument at runtime? What does it do? These docs indicate that the callback argument is a hint to Orchestrator that the task should be run asynchronously, where the executing the callback indicates that the async task has completed. With some experimentation it looks like calling the callback with no arguments returns a success state, and calling it with some string throws an error: gulp.task

wiki

百般思念 提交于 2019-12-02 23:35:21
##gulp(注:mac系统中用到了管理员权限,故命令行开头要加上sudo) ps:以下属于伪代码 1.常用步骤: (1)因为gulp是基于node开发的,所以要先全局安装node,若已安装,则下一步: 全局安装gulp npm install -g gulp gulp -h 查看帮助 (2)在桌面新建文件夹gulp-jinge,并在该文件里打开终端, gulp init 生成package.json文件 接着按要求填写项目信息(version:0.0.1),再确认 npm insatll gulp --save-dev 生成node_modules(含义:将gulp添加到pakage.json中,并作为项目的依赖) rm -rf node——modules 删除node_moduls(因为以后可以通过命令行来直接安装插件) npm install 下载项目所需的所有模块(因为package.json有gulp依赖,所以安装node_modules时,自动将gulp安装在node_modules下面) (3)在项目根目录下创建gulpfile.js文件,在gulpfile.js中写入: var gulp=require("gulp"); gulp.task("hello",function () { console.log("hello"); }); 再在终端敲入gulp

gulp API 文档

匿名 (未验证) 提交于 2019-12-02 23:04:42
gulp.src(globs[, options]) Vinyl files stream piped gulp.src('client/templates/*.jade') .pipe(jade()) .pipe(minify()) .pipe(gulp.dest('build/minified_templates')); globs String Array 所要读取的 glob 或者包含 globs 的数组。 options Object glob-stream node-glob node-glob glob-stream options.buffer Boolean true false file.contents options.read Boolean true false file.contents options.base String glob2base ) client/js/somedir somefile.js gulp.src('client/js/**/*.js') // 匹配 'client/js/somedir/somefile.js' 并且将 `base` 解析为 `client/js/` .pipe(minify()) .pipe(gulp.dest('build')); // 写入 'build/somedir/somefile.js'

Webpack Uglify plugin returns “Killed” on Ubuntu

感情迁移 提交于 2019-12-02 23:03:38
On my remote server (Ubuntu 14.04 x64), whenever I try to uglify my bundles, the process simply returns "Killed". When I don't uglify, it's just fine. Has anyone run into this? When I do it on my local Mac, it's fine (although I just tested it and it took 1.4 mins). This is my webpack.config: var webpack = require('webpack'); function makeConfig(opts) { var config = { entry: { app: ['./public/scripts/main.js'], vendor: ['lodash', 'react', 'react/lib/ReactCSSTransitionGroup', 'react-router', 'reqwest', 'd3'] }, stats: { colors: true, reasons: true }, output: { devtool: (opts.env === 'dev' ? '

Django打造大型企业官网(二)

匿名 (未验证) 提交于 2019-12-02 22:51:08
三、项目环境搭建 3.1.创建项目环境和安装包 创建django项目 mkvirtualenv DjangoProject workon DjangoProject pip install -i https://pypi.douban.com/simple django==2.0.2 进front目录 npm init #初始化一个package.json配置文件文件 在package.json文件中添加要安装的包 "devDependencies": { "browser-sync": "^2.26.7", "gulp": "^4.0.2", "gulp-cache": "^1.1.2", "gulp-concat": "^2.6.1", "gulp-cssnano": "^2.1.3", "gulp-imagemin": "^6.0.0", "gulp-rename": "^1.4.0", "gulp-sync": "^0.1.4", "gulp-tinypng-nokey": "^1.1.0", "gulp-uglify": "^3.0.2", "gulp-watch": "^5.0.1" } { "name": "xfz_front", "version": "1.0.0", "description": "xft front code", "main": "index