javascript - Gulp not creating CSS folder on production build -
i have static site uses 2 gulpfiles compile. 1 gulpfile.dev.js
compiles files correctly , uses static server served browsersync. gulpfile.prod.js
the exact same dev file, without browsersync server. when compile file using deployhq move files on server doesn't compile necessary css
folder.
my gulpfile.prod.js
file:
//dh var gulp = require('gulp'), //task runner uglify = require('gulp-uglify'), //minimizies js sass = require('gulp-ruby-sass'), //compiles css imagemin = require('gulp-imagemin'), // minimize images concat = require('gulp-concat'), concatcss = require('gulp-concat-css'), gutil = require('gulp-util'), autoprefixer = require('gulp-autoprefixer'), cssnano = require('gulp-cssnano'), pug = require('gulp-pug'), htmlmin = require('gulp-htmlmin'); // define paths sources , destination. var paths = { src: { js: './src/js/*.js', sass: './src/sass/**/*.sass', html: './views/*.pug' }, dest: { js: './app/build/js', css: './app/build/css', html: './app' } }; var autoprefixeroptions = { browsers: ['last 2 versions', '> 5%', 'firefox esr'] }; //error look-outs in gulp function errorlog(error){ console.error.bind(error); this.emit('end'); } // scripts gulp.task('scripts', function(){ gulp.src(paths.src.js) .pipe(uglify()) .on('error', errorlog) .pipe(concat('main.js')) .pipe(gulp.dest(paths.dest.js)) }); // pug -> html gulp.task('pug', function buildhtml() { return gulp.src(paths.src.html) .pipe(pug()) .pipe(gulp.dest(paths.dest.html)) .pipe(htmlmin({collapsewhitespace: true})); }); // styles gulp.task('styles', function(){ return sass(paths.src.sass) .on('error', errorlog) .pipe(autoprefixer(autoprefixeroptions)) .pipe(cssnano()) .pipe(gulp.dest(paths.dest.css)) }); //run task gulp.task('default', [ 'scripts', 'pug', 'styles']);
these bash
commands deployhq executes serve files correctly in right directory. of removing files don't need on server. build files needed served app/
move files root html directory. nam run prod
translates gulp default --gulpfile gulpfile.prod.js
cd /var/www/site.com/html npm install npm run prod rm -rf node_modules/ src/ views/ cd app cp -a build/ /var/www/site.com/html cp index.html /var/www/site.com/html cd .. rm -rf app/ rm .gitlab-ci.yml gulpfile.dev.js gulpfile.prod.js package.json .gitignore readme.md
edit:
running prod file locally compiles supposed to, on server not. not compile css folder.
edit 2:
i've changed styles task reflect gulp-ruby-sass
's documentation this:
gulp.task('styles', function(){ sass(paths.src.sass) .on('error', errorlog) .pipe(autoprefixer(autoprefixeroptions)) .pipe(cssnano()) .pipe(gulp.dest(paths.dest.css)) });
the css folder still not compile.
Comments
Post a Comment