1

Injecting css and js file links

This commit is contained in:
Alex Yatskov 2014-09-30 16:36:48 +09:00
parent e2068491d7
commit 88c9cdf4b6
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,6 @@
var concat = require('gulp-concat'); var concat = require('gulp-concat');
var gulp = require('gulp'); var gulp = require('gulp');
var inject = require('gulp-inject');
var jshint = require('gulp-jshint'); var jshint = require('gulp-jshint');
var minifyCss = require('gulp-minify-css'); var minifyCss = require('gulp-minify-css');
var sourcemaps = require('gulp-sourcemaps'); var sourcemaps = require('gulp-sourcemaps');
@ -22,6 +23,9 @@ var paths = {
'bower_components/bootstrap-select/dist/css/bootstrap-select.min.css', 'bower_components/bootstrap-select/dist/css/bootstrap-select.min.css',
'css/*.css' 'css/*.css'
], ],
html: [
'index.html'
]
}; };
gulp.task('lint', function() { gulp.task('lint', function() {
@ -44,4 +48,11 @@ gulp.task('styles', function() {
.pipe(gulp.dest('dist')); .pipe(gulp.dest('dist'));
}); });
gulp.task('default', ['lint', 'scripts', 'styles']); gulp.task('pages', function() {
var sources = gulp.src(paths.js.concat(paths.css), { read: false });
return gulp.src(paths.html)
.pipe(inject(sources))
.pipe(gulp.dest('dist'));
});
gulp.task('default', ['lint', 'scripts', 'styles', 'pages']);

View File

@ -5,10 +5,6 @@
<meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<!-- inject:css --> <!-- inject:css -->
<!-- endinject --> <!-- endinject -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
<link rel="stylesheet" href="bower_components/bootstrap-select/dist/css/bootstrap-select.min.css">
<link rel="stylesheet" href="css/style.css">
</head> </head>
<body> <body>
<div class="container"> <div class="container">