These are chat archives for less/less.js

22nd
Oct 2018
Juan Marín
@juanpmarin
Oct 22 2018 18:49
Hi, is there a way to concat all the imports in one file without processing the less code ?
dimtabu
@taburetkin
Oct 22 2018 18:59
with any task tool like gulp or grunt
i do it in this way
import gulp from 'gulp';
import concat from 'gulp-concat-util';
import less from 'gulp-less';
import size from 'gulp-size';
import cleanCss from 'gulp-clean-css';
import fancylog from 'fancy-log';
import envs from 'gulp-environments';

const prod = envs.production;



export default function taskLess(){

    let lessStream = less('styles.css');
    lessStream.on('error', e => {
        fancylog(e);
        lessStream.end();
    });

    let task = gulp.src(['src/**/*.less'])
        .pipe(concat('styles.less'))
        .pipe(lessStream)
        .pipe(size())
        .pipe(prod(cleanCss({compatability: 'ie8'})))
        .pipe(prod(size()))
        .pipe(gulp.dest('www/assets/css'));

    return task;
}


gulp.task('less', ['set-dev'], taskLess);
gulp.task('less-prod', ['set-prod'], taskLess);
Juan Marín
@juanpmarin
Oct 22 2018 19:22
But that way are removed the import sentences ?
dimtabu
@taburetkin
Oct 22 2018 19:29
no
this is only concatenate less files in one big less and transpiling it once.
Juan Marín
@juanpmarin
Oct 22 2018 19:30
Mmm I need to concat all the file and pre process it in the browser
I mean, concat all the files in compilation time and process the generated file in the front end