gulp

Gulp run fails on windows | Error Message : Microsoft JScript compilation error, Invalid character

不羁的心 提交于 2019-12-01 15:54:35
问题 I installed Node.js on my windows 7 local machine as this link says : install-node-js-npm-windows After that i installed Gulp.js by this command through command line : npm install -g gulp And then i add this path to environment variables area : C:\Users\Majid\AppData\Roaming\npm\node_modules\gulp\bin Now when i try to run gulp by this command : gulp I got this error : Windows Script Host Line: 1 Char: 1 Error: Invalid character Code: 800A03F6 Source: Microsoft JScript compilation error How

Nicely throwing an error in gulp task

懵懂的女人 提交于 2019-12-01 15:52:53
I am creating a gulp task which might fail under certain circumstances. gulp.task('favicon', function () { try { require('child_process').execSync('icotool --version'); } catch( e ) { var err = new Error( 'Unix bash and icotool required for generating favicon' ); throw err; } return gulp.src('', {read: false}) .pipe(shell([ './generate-favicon.sh' ])); }); When running my task via gulp and running into the error, the error will be presented rather ugly. I would like to present the error in a way as it is done by e.g. jslint gulp-util's PluginError . It actually works to just create a

Nicely throwing an error in gulp task

微笑、不失礼 提交于 2019-12-01 15:41:35
问题 I am creating a gulp task which might fail under certain circumstances. gulp.task('favicon', function () { try { require('child_process').execSync('icotool --version'); } catch( e ) { var err = new Error( 'Unix bash and icotool required for generating favicon' ); throw err; } return gulp.src('', {read: false}) .pipe(shell([ './generate-favicon.sh' ])); }); When running my task via gulp and running into the error, the error will be presented rather ugly. I would like to present the error in a

gulp的基本使用

喜夏-厌秋 提交于 2019-12-01 15:32:15
图片压缩插件使用gulp-smushit,gulp-smushit压缩率比较大, gulp-imagemin 图片压缩插件压缩率不明显。 见下图压缩率: 1、gulp安装 参照gulp官网进行安装: http://www.gulpjs.com.cn/docs/getting-started/ 2、常用的插件 gulp所有插件地址: http://gulpjs.com/plugins/ (1)html压缩插件 插件地址: https://www.npmjs.com/package/gulp-htmlmin/ (2)sass编译插件 插件地址: https://www.npmjs.com/package/gulp-sass/ 注意现在是执行2个任务了,同时注意配置好路径 。 (3) 图片压缩插件 gulp-imagemin 插件地址: https://www.npmjs.com/package/gulp-imagemin/ gulp-smushit 插件地址: https://www.npmjs.com/package/gulp-smushit/ (4) css压缩插件 插件地址: https://www.npmjs.com/package/gulp-clean-css/ 任务配置示例: //css压缩任务 gulp.task('cssmin', function() { //过滤掉

Gulp.js starts sass task but doesn't finish

旧时模样 提交于 2019-12-01 15:21:51
问题 My gulpfile.js var gulp = require('gulp'); // plugins var sass = require('gulp-sass'); var minifycss = require('gulp-minify-css'); // compile sass gulp.task('sass', function() { return gulp.src('static/css/scss/main.scss') .pipe(sass()) .pipe(minifycss()) .pipe(gulp.dest('/static/css/main.css')); }); gulp.task('watch', function() { gulp.watch('static/css/scss/*.scss', ['sass']); }) gulp.task('default', ['watch']); When I run gulp I get the following output: [gulp] Using gulpfile /var/www

“Cannot find module 'jquery'” - handling globals for JQuery and AngularJS in browserify with Gulp

天大地大妈咪最大 提交于 2019-12-01 15:08:05
问题 I've been trying to create a project that utilizes AngularJS , Browserify and Gulp for an excellent developer experience, one that produces a distributable 'module' (in Angular parlance). The idea being to have a self-documented project, like Angular Bootstrap , that also produces a consumable distribution for use in another application. We've had great results with Gulp , but we're having trouble with browserify/browserify-shim . Also, unfortunately, most of the examples out there either don

Jekyll clobbering directory in _site despite _config.yml.

我的梦境 提交于 2019-12-01 13:36:45
I'm building a site with Jekyll and using Gulp to manage the assets. Since I'm using Gulp to manage my assets, I would like Jekyll to ignore ./assets in the conversion process and to leave ./_site/assets/ alone when building the rest of the site. I've configured the _config.yml with exclude: [assets] # Exclude assets/ from the conversion keep: [assets] # Don't delete _site/assets when building the site My gulpfile.js is: var gulp = require('gulp'); var sass = require('gulp-ruby-sass'); gulp.task('sass', function() { return sass('assets/stylesheets/main.scss') .on('error', sass.logError) .pipe

【gulp】配置es6转es5

会有一股神秘感。 提交于 2019-12-01 13:26:26
【gulp】配置es6转es5 先安装node,然后来到项目根目录 安装gulp npm install gulp 初始化一下 npm init -y 安装babel npm install --save-dev gulp-babel babel-core 安装 ES6 转换成 ES5 插件 npm install --save-dev babel-preset-es2015 在项目根目录创建文件 .babelrc ,内容 { "presets": ["es2015"] } 配置gulp:在根目录中创建一个gulpfile.js,内容 const gulp = require('gulp'); const babel = require("gulp-babel"); //es6转es5 gulp.task("ese", function () { return gulp.src("src/*.js")// ES6存放路径 .pipe(babel()) .pipe(gulp.dest("dist")); //转换成 ES5 后存放的路径 }); // 监视src文件变化,自动执行任务 gulp.task('watch', function () { gulp.watch('src/*.js', gulp.series("ese")); }) gulp.task('start'

How do I concattinate my angular2 app javascript files

旧街凉风 提交于 2019-12-01 13:07:33
问题 For my angular2 typescript app I concat all my js files into one app.min.js file, then System.import this file to my index.html page. I then get a Multiple anonymous System.register calls in the same module file error in my console log. I put all my Javascript files (not libraries) into app.min.js and then on my index.html page I then import the file using system.import to import that js file. When I concat all the Javascript files into one file I do them in a certain order. Maybe I'm missing

Gulp can't seem to find compass mixins

时间秒杀一切 提交于 2019-12-01 12:27:15
I am trying out gulp as an alternative build tool to Grunt, to compile my scss to css, as I have heard it can be much faster. I having problems doing even a basic compile of my scss files. I have tried using the gulp-sass , gulp-ruby-sass and gulp-compass plugins for gulp and I get pretty much the same error message every time: error screen.scss (Line 2 of _grid.scss: Undefined mixin 'box-sizing'.) So it looks like it is falling down as soon as it hits a compass mixin. I have ruby installed on my PC with compass version 1.0.0.alpha.19 and sass version 3.3.7. Here is my gulpfile: var gulp =