gulp-inject

Gulp inject not working

点点圈 提交于 2019-12-20 02:54:23
问题 I'm try to use gulp-inject to inject some files into a PHP file. This is not working. I tried using HTML as well but that isn't working. The output in my console says "gulp-inject 6 files into test.html" however there's no files injected. The # of files is correct because I do have 6 JavaScript files in the directory i'm looking at in my Gulp file. Here's my Guilp task: var inject = require('gulp-inject'); gulp.task('build',function() { return gulp.src("src/test.html") .pipe(inject(gulp.src(

Inject variable into html via Gulp Task

冷暖自知 提交于 2019-12-11 13:59:16
问题 I'm using Gulp and a number of plugins to template my HTML and minify my HTML i.e. "gulp-file-include", "gulp-inject", "gulp-minify-html" none seem to offer a way of injecting a constant at build time i.e something like this: .pipe('*.html', $.gulpVar({urlpath: 'www.myurl.com'}))) then in my HTML a reference to the variable Contact Us The closest I can find to something similar is gulp-ng-constant although this injects it into the JS and uses Angular, but I'm not using Angular and wish to

How to add specific bower components as IE8 conditional block in Gulp

安稳与你 提交于 2019-12-10 15:05:43
问题 I have several bower components, of which I need some components like json3 , respondjs , es5shim to be added in an IE8 conditional block (in build as well as serve) like this : <!--[if lt IE 9]> <script src="bower_components/json3/json3.js"></script> <![endif]--> How should I proceed to write the task? I could not find any suitable examples with gulp-inject as well as wiredep for this issue. Please advise 回答1: It is possible with gulp-filter and gulp-inject's starttag option. Suppose you

Gulp-inject says “Nothing to inject into index.html”

家住魔仙堡 提交于 2019-12-10 13:24:32
问题 I'm trying to inject some files in my index, all of them concatenated and minified into a .tmp folder, as follows: gulp.task('prep-js',['clean'], function(){ var jspath = './src/page/**/*.js'; var treatJs = gulp.src(jspath) .pipe(plugins.concat('scripts.js')) .pipe(plugins.uglify()) .pipe(gulp.dest('.tmp/page/js')) }); But when I run the injection task, it says "Nothing to inject into index.html". Here's the code: gulp.task('inject-deps', ['prep-css', 'prep-js'], function(){ //select main

Gulp-inject transform doesn't work

南楼画角 提交于 2019-12-08 17:28:19
问题 I've tried to setup gulp-inject to inject dependencies into index.html. Everything works fine except transform function. I need to replace part of filepath in the following way: /frontend/src/ --> /static/ I've tried to do it like this (copy-pasted from somewhere): transform : function ( filePath, file, i, length ) { var newPath = filePath.replace('/frontend/src', ''); console.log('inject script = '+ newPath); return '<script src="/static/' + newPath + '"></script>'; } After executing, I have

Have interface extend string functionality

放肆的年华 提交于 2019-12-08 02:31:49
问题 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

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 inject not working

纵饮孤独 提交于 2019-12-01 23:01:50
I'm try to use gulp-inject to inject some files into a PHP file. This is not working. I tried using HTML as well but that isn't working. The output in my console says "gulp-inject 6 files into test.html" however there's no files injected. The # of files is correct because I do have 6 JavaScript files in the directory i'm looking at in my Gulp file. Here's my Guilp task: var inject = require('gulp-inject'); gulp.task('build',function() { return gulp.src("src/test.html") .pipe(inject(gulp.src("src/vendor/js/*.js"))); }); My test.html file looks like this: <!DOCTYPE html> <html> <head> <title>My