gulp

Gulp, html templates and fragment loading

夙愿已清 提交于 2019-12-30 23:42:49
问题 I want to import html fragments at various places in a generated html file when I run it through a gulp task. The following is my gulp task: gulp.task('build_html', function () { gulp.src('resources/index.html') .pipe(template({ident: '1'})) .pipe(gulp.dest('frontend')); }); Inside the index.html file is a lot of html I would like to load from fragments, for example a bootstrap dropdown menu <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

What does “!” mean in file paths?

♀尐吖头ヾ 提交于 2019-12-30 20:34:01
问题 I am reading over someone's gulpfile.js that I found, and came across an interesting character that I've not seen in file paths before; the ! symbol. I tried to do some searches for this but yielded nothing. gulp.task("min:js", function () { gulp.src([paths.js, "!" + paths.minJs], { base: "." }) .pipe(concat(paths.concatJsDest)) .pipe(uglify()) .pipe(gulp.dest(".")); }); Does the ! have some particular meaning, here? 回答1: I'm not an expert on Gulp, but a quick search shows that it tells gulp

What does “!” mean in file paths?

坚强是说给别人听的谎言 提交于 2019-12-30 20:33:29
问题 I am reading over someone's gulpfile.js that I found, and came across an interesting character that I've not seen in file paths before; the ! symbol. I tried to do some searches for this but yielded nothing. gulp.task("min:js", function () { gulp.src([paths.js, "!" + paths.minJs], { base: "." }) .pipe(concat(paths.concatJsDest)) .pipe(uglify()) .pipe(gulp.dest(".")); }); Does the ! have some particular meaning, here? 回答1: I'm not an expert on Gulp, but a quick search shows that it tells gulp

ASP.NET MVC, AngularJS, Bower and deploying site folder structure

我与影子孤独终老i 提交于 2019-12-30 09:33:33
问题 I've read a lot of articles and questions about site folder structure (develop & deploy) and still have missunderstood about questions below. I marked my current folder structure: Orange- looks like lib or vendor folder, where i'd like to store independent components; Blue- folder contains my own, relative to current project (application) files; Green- ready to deploy folder, that contains minified & concated files, which used to be included in index.html. There are a few questions i'd like

How to use both 'gulp-babel' and 'gulp-browserify'

独自空忆成欢 提交于 2019-12-30 08:15:59
问题 I try to write these code gulp.task('script', function() { 'use strict' return gulp.src(['app.js', 'components/**/*.jsx']) .pipe(babel()) .pipe(browserify()) .pipe(gulp.dest("dist")); }); but it shows some error: SyntaxError: /Users/Zizy/Programming/learn-react-js/components/CommentBox.jsx:58 <div className="commentBox"> ^ ParseError: Unexpected token at wrapWithPluginError (/Users/Zizy/Programming/learn-react-js/node_modules/gulp-browserify/index.js:44:10) It seems that before .pipe

npm Gulp dependencies missing, even after running npm install

最后都变了- 提交于 2019-12-30 04:40:08
问题 I have a project that uses Gulp. I deployed my project onto my Ubuntu server and now want to compile the assets (which is all my gulpfile does at the moment). Having installed Node and npm I run npm install from my project's root to install the dependencies. The package.json reads as follows: ...}, "devDependencies": { "bower": ">=1.3.12", "gulp": "^3.8.10", "gulp-concat": "^2.4.3", "gulp-less": "^2.0.1", "gulp-minify-css": "^0.4.3", "gulp-notify": "^2.2.0", "gulp-rename": "^1.2.0", "gulp

Gulp returns 0 when tasks fail

℡╲_俬逩灬. 提交于 2019-12-30 03:39:11
问题 I'm using Gulp in my small project in order to run tests and lint my code. When any of those tasks fail, Gulp always exits with return code 0. If I run jshint by hand, it exits with non-zero code as it should. Here's my very simple gulpfile. Do I need to somehow explicitly tell Gulp to return a meaningful value? Is this Gulp's fault, or maybe the gulp-jshint and gulp-jasmine plugins are to blame? 回答1: A fix has been introduced in this commit. It works something like this: gulp.src("src/**/*

Using webpack 2 from gulp (webpack-stream for webpack 2)?

北慕城南 提交于 2019-12-30 02:51:07
问题 I am trying to update to webpack 2. I use webpack-stream to run stuff from gulp, but it appears that webpack-stream is using it's own dependency on webpack which is webpack 1. I have not been able to find any webpack-stream with webpack 2. Is there any possibility to use webpack 2 from gulp? 回答1: You need to have both webpack and webpack-stream installed: npm install --save-dev webpack-stream npm install --save-dev webpack@2.1.0-beta.25 Then you can pass the webpack object as the second

How to expose 'require' to the browser when using browserify from within gulp?

两盒软妹~` 提交于 2019-12-30 00:47:08
问题 When I have a file x.js that looks like this: x.js module.exports = function (n) { return n * 111 } and I run browserify from the command line like so: browserify -r ./x.js > bundle.js I get an output file that looks like this (roughly): require=(function e(t,n,r){function ...... ./App.jsx":[function(require,module,exports){ module.exports=require('0+DPR/'); },{}]},{},[]) Then in my browser code I can do this: <html> <head> <title>React server rendering example</title> <script src="static

UglifyJS throws unexpected token: keyword (const) with node_modules

北城余情 提交于 2019-12-30 00:42:34
问题 A small project I started make use a node module (installed via npm ) that declares const variables. Running and testing this project is well, but browserify fails when UglifyJS is executed. Unexpected token: keyword (const) Here is a generic Gulp file that I have successfully been using for a few other past projects without this issue (i.e. without that particular node module). gulpfile.js 'use strict'; const browserify = require('browserify'); const gulp = require('gulp'); const source =