gulp

How to deploy gulp on production server

假装没事ソ 提交于 2019-12-05 19:22:21
问题 When building a website (for the sake of clarity an HTML/JS only website) I use gulp to compile and concat some files which are then placed in a build/ folder. The folder structure looks something like this: ├── assets │ ├── images │ ├── javascripts │ │ └── app.js │ └── stylesheets │ └── style.scss ├── bower.json ├── build │ ├── bower_components │ ├── images │ ├── index.html │ ├── scripts.min.js │ └── styles.min.css ├── gulpfile.js ├── index.html ├── node_modules │ ├── gulp-module-1 │ └──

Gulp to watch when node app.listen() is invoked or to port (livereload, nodejs and gulp)

╄→гoц情女王★ 提交于 2019-12-05 17:39:44
I am trying to get gulp-livereload to work with my nodejs server. I am using gulp-nodemon to restart the server after changes to the files, this works. I am having trouble invoking livereload.reload() at the correct time. I am currently invoking livereload.reload() on the .on('start'... in my gulpfile.js (whenever my nodemon starts a script). This works but it takes a few seconds. The reason is when nodemon starts to run the nodejs script it invokes livereload.listen() before the script has invoked app.listen(port) , so my browser refreshs without the server being ready. Is there a way to

Cache busting images which are linked inside SASS files

谁都会走 提交于 2019-12-05 17:30:14
问题 I'm fairly new to Laravel 5.0, but not to PHP. I've been playing around with Elixir to compile my SASS, copy images from my resource directory and run them through the mix.version function to prevent caching. This works great for CSS, images and JavaScript, however; is it possible to have Elixir cache-bust the images linked in my CSS/SASS as well? Sure it's easily enough to version the images but is there a way of adjusting the CSS to reflect the new filenames? I discovered this: https:/

Compile client-side Jade templates using Gulpjs

限于喜欢 提交于 2019-12-05 15:56:04
I'm trying to compile all my .jade templates into a single js file, I'm using Gulpjs and gulp-jade, gulp-concat.. I can get the single file but the problem is that all the functions rendered there have the same name, they are all called "template". foo.jade: .fooDiv h1 Foo here foo2.jade: .foo2Div h1 Foo2 here Gulp file: gulp.src("templates/**/*.jade") .pipe(jade({client: true})) .pipe(concat("templates.js")) .pipe(gulp.dest("../website/templates")) That would output a file like this: function template(locals) { var buf = []; var jade_mixins = {}; buf.push("<div class=\"fooDiv\"><h1>Foo here<

How can I concat TypeScript files with Angular2 like Rails assets:precompile?

て烟熏妆下的殇ゞ 提交于 2019-12-05 15:36:19
How can I concat multiple TypeScript with Angular2 files into single JS file like Rails assets:precompile? For example, in a tutorial of angular2 official page , you see four .ts files: app.component.ts boot.ts hero.ts hero-detail.component.ts and when you look at app.component.ts file, you see the following part: import {Hero} from './hero'; import {HeroDetailComponent} from './hero-detail.component'; It works perfectly when you compile all .ts files separately, but I'd like to concat() them into one single .js file so that there would be less http requests. I'm using gulp, and tried gulp

Combining Multiple Files with Laravel Mix

ぐ巨炮叔叔 提交于 2019-12-05 15:21:51
问题 I am currently in the process of diving into Laravel Mix and so far, whilst I fully understand what Laravel Mix is and how it works, I am trying to understand a little more about the common practices and 'How-Tos'... For instance, consider this file structure: /resources/assets/js/app.js (all global functions) /resources/assets/js/index/index.js (functions specific to index.js) /resources/assets/js/about/about.js (functions specific to about.js) /resources/assets/js/contact/contact.js

Gulp-Sourcemaps, SyntaxError: Unexpected token >

独自空忆成欢 提交于 2019-12-05 14:50:32
Gulp / npm noobie here. I'm trying to use gulp-sourcemaps, and for some reason, it crashes on var sourcemaps = require('sourcemaps') .(It crash only when this line's in the file) gulpfile: var gulp = require('gulp'); var uglify = require('gulp-uglify'); var concat = require('gulp-concat'); var sourcemaps = require('gulp-sourcemaps'); gulp.task('generateApp', function () { return gulp.src([some paths...]) .pipe(sourcemaps.init()) .pipe(concat('app.min.js')) .pipe(uglify()) .pipe(sourcemaps.write()) .pipe(gulp.dest(path...)); }); Error : C:\Projets\node_modules\strip-bom\index.js:2 module

run-sequence doesn't run gulp tasks in order

你说的曾经没有我的故事 提交于 2019-12-05 14:44:10
I have 3 tasks in my Gulp file that must run in this order: clean (deletes everything in the /dist folder) copy (copies multiple files into the /dist folder) replace (replaces some strings in some files in the /dist folder) I've read all the other posts, I've tried "run-sequence" but it's not working as the "replace" task isn't running last. I'm confused by the use of "callback". Running the tasks individually works fine. var gulp = require('gulp'); var runSequence = require('run-sequence'); gulp.task('runEverything', function(callback) { runSequence('clean', 'copy', 'replace', callback); });

install gulp browserify gives error always

空扰寡人 提交于 2019-12-05 14:39:59
Im trying to install gulp-browserify with this command: npm install gulp-browserify --save-dev I already installed many other packages successfully like gulp-autoprefixer gulp-concat gulp-minify-css gulp-sass gulp-uglify all of those installations worked great, here is how my package.json file looks like { "devDependencies": { "gulp-autoprefixer": "0.0.8", "gulp-sass": "~0.7.2", "gulp": "~3.8.5", "gulp-minify-css": "~0.3.6", "gulp-concat": "~2.2.0", "gulp-uglify": "~0.3.1" } } and here is the errors I get when installing browserify http GET https://registry.npmjs.org/uglify-to-browserify npm

Node.js入门

為{幸葍}努か 提交于 2019-12-05 14:34:37
一,了解Node.js ##1.简介: 基于事件驱动,可以实现异步,非阻塞IO 由于早期的网景公司和IE发布的浏览器都采用了Javascript的脚本语言,使用相当广泛,直到Google公司发布了基于Webkit内核的Chrome浏览器,并且重新编译了Javascript的虚拟引擎,命名为V8,使其运行的速度大幅度提升。 Node.js的发布:Ryan Dahl的程序员根据需求开发一个高性能的服务器,由于Google发布的V8引擎性能非常好,而JavaScript生来就是基于事件,可以轻松的实现回调数据而JavaScript的后端开发领域几乎是空白的,所以Node.js被创作出来,Node是节点的意思,当时的作者希望它可以构建大型分布式可扩展可伸缩的平台,每一个线程、进程甚至服务器都作为整个平台的节点 ##2.Node.js的特点 ####异步非阻塞IO 同步和异步: 同步指的是在请求资源或者查询数据库或者在进行大量运算时,需要等待操作完成才能进行下一步动作,同步的代码都是按照串行顺序完成的,中间某一个环节的错误有可能会导致整个程序的退出。 异步是相对同步而言,异步仅仅是对于上面提到的动作发送一个请求,但不需要等待请求完成,即可继续进行后续的操作,而请求的结果执行是在回调函数中完成的。 在专业术语中,同步也叫串行;异步也叫并行。 Node.js中大多数操作都支持异步操作进行