gulp

How can I use Gulp to add a line of text to a file

做~自己de王妃 提交于 2019-11-29 03:46:20
I've been trying to figure out how to add a line of text to any type of file using Gulp. For instance add: @import 'plugins' to my main.sass file. Or add a CDN to an index.html file. I did try: gulp.task('inject-plugins', function(){ gulp.src('src/css/main.sass') .pipe(inject.after('// Add Imports', '\n@import \'plugins\'\n')); }); with no joy. Any idea how I could achieve this please? Depends on what you want to do. If you just want to add text to the beginning or end of a file gulp-header and gulp-footer are your friends: var header = require('gulp-header'); var footer = require('gulp-footer

How can I use a glob to ignore files that start with an underscore?

不羁的心 提交于 2019-11-29 03:19:19
I am using this file matching in gulp: 'content/css/*.css' But I would like to only include the files that do not start with an underscore. Can someone tell me how I can do this? Here's the code: gulp.task('less', function () { gulp.src('content/less/*.less') .pipe(less()) .pipe(gulp.dest('content/css')); }); If Gulp wildcards are like shell wildcards: content/css/[^_]*.css The ^ at the beginning of a character set means to match any characters not in the set. You can add a second glob whitch will filter files or folders with an underscore. For ignore folders I use: gulp.src(['./src/**/*.html'

Running gulp task from one gulpfile.js from another gulpfile.js

北城余情 提交于 2019-11-29 02:57:50
Perhaps it's something wrong with my approach but I have a following situation: I have a component-a that has a gulpfile. One of its tasks (eg. build) builds the component and creates a combined js file in dist folder I have a component-b that has a gulpfile. One of its tasks (eg. build) builds the component and creates a combined js file in dist folder I have a project that uses both components. This project has a gulpfile as well and in it I would like to write a task that: executes build task from /components/component-a/gulpfile.js executes build task from /components/component-b/gulpfile

How do I watch multiple files with gulp-browserify but process only one?

久未见 提交于 2019-11-29 02:52:27
问题 I'm trying to wire up gulp-browserify and gulp-watch to rebuild my bundle each time a source file changes. However, gulp-browserify requires a single entry point for the compilation (e.g. src/js/app.js ) and fetches every dependency itself: gulp.src('src/js/app.js') .pipe(browserify()) .pipe(gulp.dest('dist')) However, with gulp-watch this fails to rebuild on every change because only the entry point file is being watched. What I actually need is a possibility to watch multiple files and then

Typescript build getting errors from node_modules folder

三世轮回 提交于 2019-11-29 01:45:49
I am running a typescript build and getting errors in node_modules. Why isn't it ignoring this folder? I have it in the exclude section of my tsconfig.json. The really strange thing is that I have another project that I have done a file comparison with and it does not throw these errors even though gulpfile.js, tsconfig.json and the node_modules folders are identical. What else can I check? Errors: c:/Dev/streak-maker/node_modules/angular2/src/core/change_detection/parser/locals.d.ts(3,14): error TS2304: Cannot find name 'Map'. c:/Dev/streak-maker/node_modules/angular2/src/core/change

Gulp-sass error with notify

风流意气都作罢 提交于 2019-11-29 01:19:36
问题 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

gulp.js livereload with express server?

早过忘川 提交于 2019-11-29 00:58:52
问题 I am trying to setup my gulpfile.js to use livereload on an express server without much luck. I see examples out there but they seem to be related to a static file server. http://code.tutsplus.com/tutorials/gulp-as-a-development-web-server--cms-20903 http://rhumaric.com/2014/01/livereload-magic-gulp-style/ So I have an app.js file which does the standard express server with jade files, etc. What I want to do is get it to work with livereload from a gulp.js boot. app.set('port', process.env

Angular testing with Karma: “module is not defined”

微笑、不失礼 提交于 2019-11-29 00:42:36
问题 I know this question has been asked many times, and I know that in most cases people are missing the angular-mocks.js file. I'm running into the same issue, attempting to test a factory on a module. Unfortunately, I keep running into issues with the tests (why, Angular, oh why must you assume a window and document object?), which state that module is not defined. I'm at a loss. I've also tried using angular.mocks.module, but then I get a message saying Angular isn't defined. What am I doing

跟着文档学习gulp1.1安装入门

自闭症网瘾萝莉.ら 提交于 2019-11-29 00:33:46
Step1:检查是否已经安装了node,npm 和 npX是否正确安装 Step2:安装gulp命令行工具(全局安装gulp) npm install --global gulp-cli Step3:创建项目目录并且进入 mkdir my-project cd my-project Step4:在项目目录下创建package.json文件 npm init Step5:安装gulp,作为开发时依赖项(之前安装的事全局本地的,可是之后如果发布你的作评不可能要求别人也在自己本地野全局安装的,所以在项目里面也需要安装,这样子,下载之后的项目就自带了你所要依赖的依赖项) npm install --save-dev gulp Step6:检查gulp版本 Step7:创建gulpfile文件,在根目录下创建并输入以下内容 function defaultTask(cb){ // place code for your default task here cb() } exports.default = defaultTask; Step8:测试运行gulp 来源: https://www.cnblogs.com/chorkiu/p/11436058.html

Deploy angular application on IIS

[亡魂溺海] 提交于 2019-11-29 00:10:37
问题 I am working on AngularJs application with node.js. Using gulp, I have created (compiled) my application ( app in below image) and got the following directories Now I completely struck how to proceed next. I want to host this application over IIS to run and see the pages (in views folder) but I don't know how to host it on IIS. I tried this article, but it guides to use express server. The issue is, how IIS will figure out that the first page lies in views folder, and even if I use the