gulp

Gulp - Handle read-only permissions for dest files?

拜拜、爱过 提交于 2019-12-19 05:11:40
问题 I have image files with read-only attribute set in source folder. I need to copy them to destination folder in most cases several times in gulpfile.js. I am trying to copy src-to-dest files like this: gulp.task('copy-images', function () { gulp.src(path_resource_images + '**/*.jpg') .pipe(gulp.dest(path_app_images)); }); It works once when the dest folder in empty. But for all next calls I've got an exception that file is read-only in dest folder. How can I remove file attr read-only to make

Gulp Autoprefixer Not Working

微笑、不失礼 提交于 2019-12-19 03:19:08
问题 I'm unable to get Autoprefixer to work with Gulp. I'm using opacity in my CSS, gradients, and transforms and there aren't any vendor prefixes showing up. Otherwise, everything else is working. Here's my gulp file: var gulp = require('gulp'); var lr = require('tiny-lr'); var jshint = require('gulp-jshint'); var sass = require('gulp-sass'); var autoprefixer = require('gulp-autoprefixer'); var minifycss = require('gulp-minify-css'); var concat = require('gulp-concat'); var rename = require('gulp

Gulp - CALL_AND_RETRY_LAST Allocation failed - process out of memory

限于喜欢 提交于 2019-12-18 23:13:57
问题 When calling one of my gulp task, I get " FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory ". I found in this question that I can pass a parameter to node to increase the default memory limit : node --max-old-space-size=2000 server.js . But how can I tell gulp to pass a parameter to node.exe ? Here is the list of flags I can pass to gulp, I was hoping to find one that gulp passes to node when it launches it for a task. The task causing the issue : var gulp = require(

Can't get external library with browserify and debowerify

蓝咒 提交于 2019-12-18 21:54:31
问题 I have a headache on my hands. Here's my current setup: bower to get vendor libraries (angular in this case) gulp task to run browserify debowerify to make the bower libraries compatible with browserify App.js (before browserify): 'use strict'; var angular = require("angular"); var Routes = require("./routes"); angular.module('MyAngularApp') .config(Routes); App.js (after browserify/in the bundle.js): var angular = require("./../ext/angular/angular.js"); var Routes = require("./routes");

Open Karma debug.html page on startup

和自甴很熟 提交于 2019-12-18 20:48:01
问题 The short version: How do I start up Karma and have it open the debug.html file automatically in the same browser as the Karma start page? The long version: I'm not a huge fan of using the console reporters for Karma, so I have been using karma-jasmine-html-reporter-livereload which outputs to Karma's localhost:9876/debug.html file. The problem is, every time I start a debugging session, I have to click the 'debug' button in the web page that karma opens. I would like to find a way to have

How convert .jsx to .js with Gulp and Babel?

筅森魡賤 提交于 2019-12-18 14:16:12
问题 I need to convert all /src/ .jsx files to /src/ .js Before I used gulp-react: var react = require('gulp-react'); gulp.task('jsx', function () { return gulp.src('src/jsx/*.jsx') .pipe(react()) .pipe(gulp.dest('src/js/')); }); It works but not without some small mistakes. When I use Babel website (https://babeljs.io/repl/) all converts right. Could you help me. How can I set gulp to convert .JSX files? 回答1: First you need to install these two packages: npm install gulp-babel babel-plugin

What are the purposes of vinyl-buffer and gulp-streamify in gulp?

你。 提交于 2019-12-18 14:12:30
问题 As the documentation says, they both deal with transforming non-stream plugins to stream. What I try to understand is, if I can use the .pipe() method on something, doesn't it mean it's a stream? If so, what do I convert to what here? vinyl-source-stream example: (from: https://www.npmjs.com/package/vinyl-buffer) var browserify = require('browserify') var source = require('vinyl-source-stream') var buffer = require('vinyl-buffer') var uglify = require('gulp-uglify') var size = require('gulp

How can I use gulp to replace a string in a file?

余生长醉 提交于 2019-12-18 14:04:47
问题 I am using gulp to uglify and make ready my javascript files for production. What I have is this code: var concat = require('gulp-concat'); var del = require('del'); var gulp = require('gulp'); var gzip = require('gulp-gzip'); var less = require('gulp-less'); var minifyCSS = require('gulp-minify-css'); var uglify = require('gulp-uglify'); var js = { src: [ // more files here 'temp/js/app/appConfig.js', 'temp/js/app/appConstant.js', // more files here ], gulp.task('scripts', ['clean-js'],

前端构建工具gulp入门教程

爷,独闯天下 提交于 2019-12-18 13:33:44
最近想搞些自动化,网上搜了不少的关于gulp的攻略,然后结合自己的一些实践发出来。如果对你有帮助也别谢谢我。如果误导了你,也别喷我。。。。水平有限。呵呵 本文假设你之前没有用过任何任务脚本(task runner)和命令行工具,一步步教你上手Gulp。不要怕,它其实很简单,我会分为五步向你介绍gulp并帮助你完成一些惊人的事情。那就直接开始吧。 第一步:安装Node 首先,最基本也最重要的是,我们需要搭建node环境。访问 http://nodejs.org ,然后点击大大的绿色的 install 按钮,下载完成后直接运行程序,就一切准备就绪。 npm 会随着安装包一起安装,稍后会用到它。 第二步:使用命令行 也许现在你还不是很了解什么是命令行——OSX中的终端(Terminal),windows中的命令提示符(Command Prompt),但很快你就会知道。它看起来没那么简单,但一旦掌握了它的窍门,就可以很方便的执行很多命令行程序,比如Sass,Yeoman和Git等,这些都是非常有用的工具。 如果你很熟悉命令行,直接跳到步骤四。 为了确保Node已经正确安装,我们执行几个简单的命令。 node -v 回车(Enter),如果正确安装的话,你会看到所安装的Node的版本号,接下来看看npm。 npm -v 这同样能得到npm的版本号。 如果这两行命令没有得到返回

Promise is undefined in IE11 using babel-polyfill

我们两清 提交于 2019-12-18 12:55:18
问题 As the title says, even I'd like to use babel-polyfill to allow me to use promises in my code, but I get that undefined error in IE11. I've been trying to make this work for a while as I've seen that has been asked in different sites a few times, but none of the solutions really worked for me (or more accurately I was probably not able to adapt them to my code) These are the files that, I think, are involved: .babelrc { "presets": [ "es2015", "react" ] } package.json: I have babel-polyfill