javascript - Loop a Stylus command in Elixir -


i have switchable themes , colors site, , need elixir/gulp render possible theme-color combinations css files. here's gulpfile.js:

var gulp = require('gulp'),     notify = require('gulp-notify'),     elixir = require('laravel-elixir'),     stylus = require('laravel-elixir-stylus'),     watch = require('gulp-watch');  var themes = [     "alpha",     "beta" ];  var colors = [     "blue",     "red",     "green" ];  if(elixir.config.babel)     elixir.config.babel.enabled = false;  elixir(function(mix) {     for(ti = 0; ti < themes.length; ++ti) {         for(ci = 0; ci < colors.length; ++ci) {             mix.stylus([                 'colors/'+colors[ci]+'.styl',                 'themes/'+themes[ti]+'/main.styl'             ], "public/css/"+themes[ti]+"."+colors[ci]+".css");         }     } }); 

to me, looks should run. tested loop, , know goes through every theme-color combination fine.

however, when run it, creates folder beta.green.css, inside of 2 files, main.styl , green.styl.

  1. how make generate of stylus commands, , not last one?
  2. how make combine results in single file, , not 2 separate files in folder?

eventually ended ditching elixir altogether , doing in pure gulp;

gulp.task('styles', function(cb){     async.each(themes, function(theme, done) {         async.each(colors, function(color, next) {             gulp                 .src([                     './resources/assets/stylus/colors/'+color+'.styl',                     './resources/assets/stylus/themes/'+theme+'/main.styl'                 ])                 .pipe(stylus())                 .pipe(concat(theme+"."+color+'.css'))                 .pipe(gulp.dest('./public/css'))                 .on("end", next);         }, done);     }, cb); }); 

Comments