Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp-inject says to me "Nothing to inject" #225

Open
DennisBoanini opened this issue Jun 7, 2017 · 0 comments
Open

gulp-inject says to me "Nothing to inject" #225

DennisBoanini opened this issue Jun 7, 2017 · 0 comments

Comments

@DennisBoanini
Copy link

I have this gulp file

var gulp = require('gulp'),
	browserSync = require('browser-sync').create(),
	sass = require('gulp-sass'),
	bower = require('gulp-bower'),
	inject = require('gulp-inject'),
	mainBowerFiles = require('main-bower-files');

gulp.task('browser-sync', ['sass'], function(){
	browserSync.init({
		server: "./app",
		notify: false,
		port: 8080,
		ui: {
			port:8081
		}
	});
});

gulp.task('watch', ['bower', 'browser-sync'], function(){
	gulp.watch("app/scss/*.scss", ['sass']);
	gulp.watch("bower.json", ['bower-inject']);
	gulp.watch("app/js/*.js").on('change', browserSync.reload);
	gulp.watch("app/*.html").on('change', browserSync.reload);
});

gulp.task('sass', function(){
	return gulp.src("app/scss/*.scss")
		.pipe(sass())
		.pipe(gulp.dest("app/css"))
		.pipe(browserSync.stream());
});

gulp.task('default', ['watch']);

gulp.task('bower', function(){
	return bower();
});

gulp.task('bower-inject', function(){
	return gulp.src('app/index.html')
    .pipe(inject(gulp.src(mainBowerFiles(), {read: false}), {name: 'bower'}))
    .pipe(inject(gulp.src('app/**/*.{css,js}', {read: false}), {relative: true}))
    .pipe(gulp.dest('app'));
});

when I install a dependencies with bower the console show me this message

[17:11:07] Starting 'bower-inject'...
[17:11:07] gulp-inject Nothing to inject into index.html.
[17:11:07] gulp-inject Nothing to inject into index.html.
[17:11:07] Finished 'bower-inject' after 22 ms
[BS] Reloading Browsers...
[17:17:11] Starting 'sass'...
[BS] 2 files changed (hhhh.css, main.css)
[17:17:11] Finished 'sass' after 11 ms

and nothing is injected in the index page, that have this form

<!doctype html>
<html>
<head>
	<title>GULP TEST</title>
	<!-- bower:css -->
	<!-- endbower -->
</head>
<body>
	<!-- bower:js -->
	<!-- endbower -->
</body>
</html>

This my folder structure
Schermata del 2017-06-07 17-24-48.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant