gulp

Have interface extend string functionality

允我心安 提交于 2019-12-06 10:50:32
I'm using these tools together: TypeScript Gulp Gulp-Inject I'm trying to do the following: module My { interface IGulpInjectable extends string { // << Problem here! [gulp_inject: string] : string; } export class Cache { private items: { [key: string] : IGulpInjectable }; constructor() { this.items = { "item1": { gulp_inject: "file1.html" }, "item2": { gulp_inject: "file2.html" } } } getItem(key: string){ return this.items[key].trim(); } } } What gulp-inject does is replace { gulp_inject: "x.html" } with a string containing the file contents. This is why I want to have IGulpInjectable extend

gulp-uglify won't preserve files order

梦想的初衷 提交于 2019-12-06 09:56:55
When I use gulp-uglify to minify the Javascript files the order gets messed up. Lets say I have this task working as expected: var gulp = require('gulp'); var rename = require('gulp-rename'); var gp_concat = require('gulp-concat'); gulp.task('js', function() { gulp.src([ './public/bower_components/jquery/dist/jquery.min.js', './public/js/functions.js', ]) .pipe(gp_concat('combined.js')) .pipe(gulp.dest(path.js + '/dist')) }); Adding the uglify line to it changes the order of the jquery and functions files and places functions.js above jquery . var gulp = require('gulp'); var rename = require(

I need to pass a parameter to a gulp task from another task or replace a task with a function called by runSequence

牧云@^-^@ 提交于 2019-12-06 09:38:24
I have gulp file that I use to create the Html and Js for multiple kinds of exams, Ex1, Ex2 etc Here's the task I use to create these for Ex1. It has hardcoded a call to the makeEx1Html task, three other tasks and followed by a function call where I can pass a parameter: gulp.task('make_prod_ex1', function () { runSequence( 'makeEx1Html', 'makeTemplate', 'rename_bundle_css', 'rename_bundle_js', function () { make_prod_index('ex1'); }); }); Here's the task that's hardcoded for Ex1: gulp.task('makeEx1Html', function () { return gulp.src(config.srcEx1Html, { base: process.cwd() }) .pipe(print

How to zip multiple folders generating multiple .zip files in gulp?

落花浮王杯 提交于 2019-12-06 09:30:21
问题 My folder structure looks like this: - /projects - /projects/proj1 - /projects/proj2 - /projects/proj3 - /zips For each folder in projects (proj1, proj2 and proj3) I want to zip contents of each of those folders and generate proj1.zip , proj2.zip and proj3.zip in /zips folder. Following example function generates single zip file from proj1 folder zip = require('gulp-zip'); gulp.task('default', function () { return gulp.src('./projects/proj1/*') .pipe(zip('proj1.zip')) .pipe(gulp.dest('./zips'

Protractor passes tests without running the tests

丶灬走出姿态 提交于 2019-12-06 09:17:53
问题 SYMPTOMS When Protractor is run, the test pass however Protractor does not run through the pages. The page load blank and have "data:text/html" or "data:text/html" in the address. (see screenshot). The test show passes but 0 assertions. See the Protractor output below. Also, I work on a team. This does not occur with other team members. CONFIGURATION Protractor 2.2.0 Gulp Protractor 1.4.28 Chrome 49.0.2623.112 [09:49:23] Using gulpfile c:\Workspace\main\cuas-ui\gulpfile.js [09:49:23] Starting

Syntax Error when using Gulp to compile React in ES6

别等时光非礼了梦想. 提交于 2019-12-06 08:37:28
When I try to compile the following code using React I get the error below. I don't see the issue in such a simple program and the example code compiles correctly when I clone the git repo. main.js: import React from 'react'; import HelloWorld from './components/helloworld'; //import HelloWorld from './hello-world-es5'; React.render( <HelloWorld phrase="ES6"/>, document.body ); HelloWorld: import React from 'react'; class HelloWorld extends React.Component { render() { return <h1>Hello from {this.props.phrase}!</h1>; } } export default HelloWorld; error: SyntaxError: /Users/**/**/**/**/js/main

Path to source map is wrong

情到浓时终转凉″ 提交于 2019-12-06 08:35:23
问题 I use the packages gulp-less and gulp-sourcemaps . My less file is located under Styles/main.less , but the generated source map points to source/main.less (where source/ seems to be a prefix). How to fix this, so the source map correctly points to source/Styles/main.less ? My gulp task is rather simple: var gulp = require('gulp'), less = require('gulp-less'), gulpif = require('gulp-if'), sourcemaps = require('gulp-sourcemaps'); var paths = { styles: [ 'Styles/**/*.less', '!**/*.min.css' ],

SASS task in gulp with sourceComments: 'map' produces 'Assertion failed'

一曲冷凌霜 提交于 2019-12-06 08:29:13
问题 I have a web app I'm developing using AngularJS, D3, Pixi.js, and gulp as a build system. It all works great together, except gulp-sass . Here's the relevant code: gulp.task('sass-dev', ['clean-dev'], function() { return gulp.src( cfg.appFiles.rootSass ) .pipe( sass({ errLogToConsole: true })) .pipe( gulp.dest( cfg.buildDir+cfg.destDirs.css ) ) .pipe( livereload( server ) ); }); cfg is just a variable that has predefined globs. If I make the third line .pipe( sass({ errLogToConsole: true,

Trouble including slick-carousel with global jQuery using Browserify / Browserify Shim

北慕城南 提交于 2019-12-06 08:26:10
I'm using Browserify 11.2 and Browserify Shim 3.8 and am attempting to utilize slick-carousel (included via npm) with a jQuery loaded from a CDN. I realize that this requires the use of Browserify shim, but I am unable to get it to work. Here is the relevant portion of my package.json file. "devDependencies": { ... "browserify": "^11.2.0", "browserify-shim": "^3.8.10", ... "slick-carousel": "^1.5.8", ... }, "browserify": { "transform": [ "browserify-shim" ] }, "browser": { }, "browserify-shim": { "jquery": "global:jQuery", "slick-carousel": { } }, "dependencies": { } When attempting to require

Run gulp task after completion of other task

一曲冷凌霜 提交于 2019-12-06 08:24:11
问题 I have two sets of files, let's call them base and mods . The mods files override the base files, so when I run the gulp task related to base , I need to run the mods task directly after. My setup is something like this: gulp.task('base',function(){ return gulp.src('base-glob') .pipe(...) .pipe(gulp.dest('out-glob')) }); gulp.task('mods',function(){ return gulp.src('mods-glob') .pipe(...) .pipe(gulp.dest('out-glob')) }); So I want to run the mods task at the completion of the base task. Note