gulp

【转】有关 Grunt

断了今生、忘了曾经 提交于 2019-12-02 22:19:48
原文: https://segmentfault.com/a/1190000005029360?utm_source=tuicool&utm_medium=referral 之所以想写有关前端自动化工具的文章出于以下几个原因: 自动化构建工具对于前端开发的重要性:高效、减少重复性操作、各种强大插件的支撑。 构建工具的上手使用有一定的成本,其中也有不少坑踩,前端在掌握html/js/css三剑客的同时,还需要了解node.js、npm包管理器、构建工具的配置、语法糖以及插件的使用,也要学会当构建工具的使用日趋复杂庞大的时候如何优雅有效的组织代码,减少在使用工具的时候出现bug的概率。 工作中遇到一些grunt相关的常用实例与奇技淫巧可以拿来品玩、解读,有助于更快速上手并定制一套强大的自动化工作方式。 同类的构建工具例如gulp、webpack(严格意义上它应该是模块管理工具,但它依旧可以做一些构建的工作),甚至是扬言可以摈弃grunt与gulp的npm scripts,它们各有各的可取之处,刷新了我对构建工具的认识。而在我看来,与其争论个孰好孰坏,还不如用上一个自己觉得顺手的、更贴合项目需求的工具库。 自动化构建工具 - Grunt 先说下在没有诞生这些工具之前写前端代码的一些痛点: “css写得好费劲啊,那些可复用的样式能不能存在一个变量或函数里直接调用啊”

Django2.1视频教程

匿名 (未验证) 提交于 2019-12-02 22:11:45
课程名称:超细讲解Django打造大型企业官网 课程类型:Python3.7, Django2.1 课程数量:334集 课程代码:有 总共大小:44.5 GB 共享连接:链接: https://pan.baidu.com/s/1WMqpupMC75NGi6pFV3x0xA 提取码:1rv6 课程目录:001.【虚拟环境】为什么需要虚拟环境.mp4      002.【虚拟环境】virtualenv创建虚拟环境.mp4      003.【虚拟环境】virtualenvwrapper使用.mp4      004.【Django预热】URL组成部分详解.mp4      005.【Django预热】课程准备工作.mp4      006.【Django预热】Django介绍.mp4      007.【Django URL】第一个Django项目剖析(1).mp4      008.【Django URL】第一个Django项目剖析(2).mp4      009.【Django URL】Django的项目规范.mp4      010.【Django URL】DEBUG模式详解.mp4      011.【Django URL】视图函数介绍.mp4      012.【Django URL】URL映射补充.mp4      013.【Django URL】url中传递参数给视图函数

Visual Studio Task Runner Error with ES6

♀尐吖头ヾ 提交于 2019-12-02 22:10:34
I am running Visual Studio 2017 and use the Task Runner to run tasks in my gulpfile . I recently updated a gulp task to ES6 and now am getting this error: Failed to run "C:\Users\nz9rcn\Code\WebUI\Gulpfile.js"... cmd.exe /c gulp --tasks-simple C:\Users\nz9rcn\Code\WebUI\gulp-tasks\lesslint.js:5 let fail = false; ^^^ SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:373:25) at Object.Module._extensions..js (module.js:404:10) at Module.load (module.js:343:32) at

Read a bunch of JSON files, transform them, and save them

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 21:51:29
问题 I'm trying to achieve this with Gulp . Read every .json file in a given directory including subdirectories. Transform them in some way, for example add a new root level, etc. Save them into a new directory keeping original structure. The point where I'm lost is how to pipe reading/writing JSON to src . I have the following skeleton now. gulp.task("migratefiles", function () { return gulp.src("files/**/*.json") .pipe(/* WHAT HERE? */) .pipe(gulp.dest("processed")); }); 回答1: There's a number of

Gulp-sass error with notify

核能气质少年 提交于 2019-12-02 20:54:49
I wondered if there is a way to have notify display a message on gulp-sass error. preferably the actual message that is displayed in the console. my gulp task looks like this: gulp.task('styles', function() { return gulp.src('src/scss/style.scss') .pipe(sass({ style: 'compressed', errLogToConsole: true })) .pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4')) .pipe(gulp.dest('')) .pipe(livereload(server)) .pipe(notify({ message: 'Styles task complete' })); }); I'd like to pipe the notify to some kind of error callback. Any help appreciated. After

Gulp: How to create a task that compiles multiple SASS files?

白昼怎懂夜的黑 提交于 2019-12-02 20:54:44
I have the following sass task which compiles app.scss to app.css and reloads the page: gulp.task('sass', function() { return gulp.src('./app/app.scss') .pipe(sass()) .pipe(gulp.dest('./app')) .pipe(livereload()); }); Now, I want to compile another file, namely ui-toolkit.scss to ui-toolkit.css . Is this the best way to update the task? gulp.task('sass', function() { gulp.src('./ui-toolkit/ui-toolkit.scss') .pipe(sass()) .pipe(gulp.dest('./ui-toolkit')); return gulp.src('./app/app.scss') .pipe(sass()) .pipe(gulp.dest('./app')) .pipe(livereload()); }); Just specify glob(s) that match multiple

Incremental gulp less build

岁酱吖の 提交于 2019-12-02 20:54:22
In my office we are using gulp to build our less files. I wanted to improve the build task as it took over a second to build on a large project we recently worked on. The idea was to cache the files and only pass the one that changed. So I started with google and found incremental builds for javascript ang thought it would be easy to rewrite them for less. Here's the one I started with: https://github.com/gulpjs/gulp/blob/master/docs/recipes/incremental-builds-with-concatenate.md After a few unsuccessful tries I ended up with following code (tested with the latest bootstrap distribution): var

Gulp Watch and Nodemon conflict

喜欢而已 提交于 2019-12-02 20:53:17
Short of it: started using Gulp recently (convert from Grunt), and am trying to use both Gulp's default watch task (not gulp-watch from npm) for SASS/JS/HTML and gulp-nodemon (from npm) to restart an Express server upon changes. When running just gulp watch , it works fine; and when running gulp server (for nodemon) that works fine. However, using both together (shown below in the configuration of the default task), the watch stuff isn't working. The task is running, and on the CLI gulp shows 'Starting' and 'Finished' for the watch tasks, but the files don't update. Relevant task

gulp-notify: [Error in notifier] Error in plugin 'gulp-notify' not found: notify-send

不羁岁月 提交于 2019-12-02 20:37:57
I'm trying to setup Gulp in my install of Laravel 5.1. I've ran then command npm install as specified in the Laravel documentation and that's worked fine. However, when I now run the command gulp I get the following message: ubuntu@NAME:/var/www/html/FOLDER# gulp [14:04:56] Using gulpfile /var/www/html/FOLDER/gulpfile.js [14:04:56] Starting 'default'... [14:04:56] Starting 'sass'... [14:04:56] Running Sass: resources/assets/sass/app.scss [14:04:56] Finished 'default' after 532 ms [14:04:56] gulp-notify: [Laravel Elixir] Sass Compiled! [14:04:56] Finished 'sass' after 666 ms [14:04:56] gulp

How to improve webpack performance?

旧城冷巷雨未停 提交于 2019-12-02 20:25:40
I recently switched from browserify to webpack and the build time jumped from 4s to 16s on (2014 MBP). I understand webpack does alot more than browserify but i shouldn't take that long. My build process is fairly simple. Are there any tips or options to improve my build time? var webpackOptions = { cache : true, output: { filename: '[name].js', }, module: { loaders: [ { test: /\.js$/, loader: 'jsx-loader' }, { test: /\.css$/, loader: "style!css" } ] }, }; gulp.task('buildJs', function(){ multipipe( gulp.src(jsSrcPath), named(), webpack(webpackOptions), uglify(), gulp.dest(jsDestPath) ).on(