gulp

Gulp copying empty directories

一曲冷凌霜 提交于 2019-12-22 04:25:28
问题 In my gulp build I've made a task that runs after all compiling, uglifying and minification has occurred. This task simply copies everything from the src into the dest directory that hasn't been touched/processed by earlier tasks. The little issue I'm having is that this results in empty directories in the dest directory. Is there a way to tell the gulp.src glob to only include files in the pattern matching (like providing the 'is_file' flag)? Thanks. 回答1: Fixed it by adding a filter to the

Where should I store JS in Laravel 5?

▼魔方 西西 提交于 2019-12-22 04:25:09
问题 There are 2 places where I can store javascripts: resources/assets/javascripts and public/js . If we put the files in resources/assets/javascripts , we should add gulp tasks to copy them. And this is a weakness of this method. And we will need path mapping in browser debugger. If we put these files in public/js , we will have our source JS and compiled JS in one place and they will be messed up. So, where should I store JS in Laravel 5? 回答1: The "Laravel-5" answer is to put them in resources

Angular2 lazy loading modules: how to create a build package with SystemJS Builder?

﹥>﹥吖頭↗ 提交于 2019-12-22 04:17:11
问题 i'm using Angular2 and SystemJS to create a web application. I have some modules in my app and in the router configuration i use lazy loading to open them. Here is a routing file of my app that lazy loads two modules: const appRoutes: Routes = [ { path: '', component: MainComponent, canActivate: [AuthGuard], children: [ { path: 'dashboard', component: DashboardComponent }, { path: 'first-section', loadChildren: 'app/modules/FIRST-SECTION/first-section.module' }, { path: 'second-section',

Gulp deploy dist folder of Node app to Heroku

帅比萌擦擦* 提交于 2019-12-22 03:44:30
问题 I'm reasonably new to node, git, github and Heroku and I'm struggling to work out the best way of sending my application to Heroku without cluttering up the repo with my compiled, minified app and without doing too much in Heroku. My node.js project looks a bit like this: - client ... code - server ... code - node_modules - package.json - gulpfile.js - dist - client - server Everything apart from node_modules and dist goes into github. The gulpfile compiles, minifies and concatenates

How to make Gulp.src fail if a file is missing?

寵の児 提交于 2019-12-22 03:33:21
问题 Our gulp build takes a bunch of libraries installed with bower, then concatenates them with all the code we have distributed across several directories. Here's what it looks like: var jsFiles = [ sourcePath + '/config/config.js', sourcePath + '/vendor/jquery/dist/jquery.js', sourcePath + '/vendor/js-cookie/src/js.cookie.js', sourcePath + '/vendor/modernizr/modernizr.js', sourcePath + '/vendor/lodash/lodash.js', sourcePath + '/vendor/picturefill/dist/picturefill.min.js', sourcePath + '

browser-sync is blocked by chrome csp

你说的曾经没有我的故事 提交于 2019-12-21 20:46:03
问题 I have a gulp task that runs browsersync. var options = { proxy : 'localhost:9000/html' , port : 3000 , files : [ config.root + config.srcPaths.htmlBundle , config.htmlRoot + 'main.css' , '!' + config.htmlRoot + '**/*.scss' ] , injectChanges : false , logFileChanges : true , logPrefix : 'broserSync ->' , notify : true , reloadDelay : 1000 }; browserSync( options ); browsersync detects changes and tries to inject them but chrome blocks it with this error: Refused to connect to 'ws://localhost

GULP: Modify a watched file in place without causing an infinite loop

我只是一个虾纸丫 提交于 2019-12-21 19:59:05
问题 Im trying to use gulp and jscs to prevent code smell. I also want to use watch so that this happens when ever a change is made. The problem I'm running into is jscs is modify the source file that is being watched. This causes gulp to go into an infinite loop of jscs modifying the file and then watch seeing the change and firing off jscs again and again and again ... const gulp = require('gulp'); gulp.task('lint', function() { return gulp.src('/src/**/*.js') .pipe(jscs({ fix: true })) .pipe

gulp-sass compiles Google Fonts CSS into the file, breaks protocol-relative link

有些话、适合烂在心里 提交于 2019-12-21 16:53:11
问题 When I use the following code in my .scss file @import url('//fonts.googleapis.com/css?family=SomeFont:400,700,400italic'); the SASS parser I use (nodejs gulp-sass ) happily downloads the file from said location and includes it as plain text in the compiled output. Here's my Gulpfile: var gulp = require('gulp'), sourcemaps = require('gulp-sourcemaps'), autoprefixer = require('gulp-autoprefixer'), minify = require('gulp-minify-css'), rename = require('gulp-rename'), sass = require('gulp-sass')

Import .css file in Less using nodejs gulp

一世执手 提交于 2019-12-21 10:10:15
问题 According to this question it's possible to import css file from less v.1.4.0. I tried to use gulp-less task, and it's not working. There's any way to import css file like this: @import "../spritesheet.css"; with nodeJS gulp? 回答1: There are several ways to include files in LESS, depending on what you need, using @import ([keyword]) "filename" . Allowed keywords are: reference: use a Less file but do not output it inline: include the source file in the output but do not process it less: treat

Gulp less and then minify task

天涯浪子 提交于 2019-12-21 09:18:16
问题 I have to make 2 steps in gulp: Make a .css file form less Minify generated css files This is my gulpfile: var gulp = require('gulp'), watch = require("gulp-watch"), less = require('gulp-less'), cssmin = require('gulp-cssmin'), rename = require('gulp-rename'); gulp.task('watch-less', function () { watch({glob: './*.less'}, function (files) { // watch any changes on coffee files gulp.start('compile-less'); // run the compile task }); watch({ glob: ['./*.css', '!./*.min.css'] }, function(files)