Closed mikaelplouhinecvetup closed 7 years ago
Are you saying D:\Projets\vetup\myband- player\source\app\dist\scripts\lib\bowser-1.6.0.js
the file is not there?
Yes that'r right.
Its the same for css.
In my PHP I have also :
<!-- build:css styles/main-min.css -->
<link rel="stylesheet" type="text/css" href="styles/main.css?cache-desktop=<?php echo APP_VERSION; ?>">
<!-- endbuild -->
For the css, I don't have the main.css file in my target folder. I thought JS would be work the same way as CSS.
For more informations, this is my gulpfile :
var gulp = require('gulp');
var csso = require('gulp-csso');
var rename = require('gulp-rename');
var del = require('del');
var debug = require('gulp-debug');
var stripDebug = require('gulp-strip-debug');
var useref = require('gulp-useref');
var count = require('gulp-count');
var bowerMain = require('main-bower-files');
var concat = require('gulp-concat');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var gulpFilter = require('gulp-filter');
var uglify = require('gulp-uglify');
var flatten = require('gulp-flatten');
var vulcanize = require('gulp-vulcanize');
// Déclaration des constantes de paths
var source = './app/public';
var target = './app/dist';
// Déclaration des répertoires à copier tels quels
var foldersToBeCopied = [
source + "/bower_components/**/*",
source + "/config/**/*",
source + "/elements/**/*",
source + "/images/**/*",
source + "/locales/**/*",
source + "/scripts/**/*",
source + "/sendgrid-php/**/*",
source + "/styles/**/*",
source + "/*",
"!"+source+"/bower.json",
"!"+source+"/styles/*.css", // On ne copie pas le css car on le minifie
"!"+source+"/scripts/lib/*.js" // On ne copie pas le js des libs ext
];
// clean dist folder
gulp.task('cleanTargetFolder', function(){
return del(target + "/*", {force:true});
});
// full copy
gulp.task('copyToTarget', ['cleanTargetFolder'], function(){
return gulp.src(foldersToBeCopied, { base: source }).
pipe(gulp.dest(target));
});
// Minify du css
gulp.task('minifyCss', function(){
return gulp.src([source + '/styles/**/*.css', source + '!styles/**/*.min.css'])
.pipe(csso())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(target + "/styles/"));
});
// Ext lib JS
gulp.task('extLibJS', function(){
return gulp.src([source + '/scripts/lib/*.js'])
.pipe(concat('ext-lib.js'))
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(target + "/scripts/lib/"));
});
// Update css, JS reference in index.php
gulp.task('updateReferenceInPHP', function(){
return gulp.src(target + "/*.php")
.pipe(debug())
.pipe(useref())
.pipe(debug())
.pipe(gulp.dest(target));
});
Yeah the files have to be there or you have to give it the path to the files.
Ok. I'm going to try specifying not the target path but the source path.
Could you just explain me why It works for css files and not for JS files?
No. It shouldn't work for CSS files either.
But id does ^^
Thanks for your help.
Hello,
I have this in my php file :
When I execute the following gulpfile task,
I receive the following error :
I thought userref doesn't check the existence of files. Is there a problem in my task?