How can I build multiple themes?


I’m working on a project where I want to have one js codebase, but switch the css file used based on the accessing user. I can get that to work just fine and thought that semantic-ui would be a great fit as it has themes built in. I wanted to create a theme per group of users and allow them to see their specific skin. I have been trying to manipulate the build for a while to get it to work how I want but so far have been unsuccessful. Is there a way to run a build and have it run multiple times either with different semantic.json files or some other way?

Here is what I’ve done so far. I updated my tasks/build/css.js file to the following.

const console = require('better-console');
const extend = require('extend');
const fs = require('fs');
const gulp = require('gulp');
const autoprefixer = require('gulp-autoprefixer');
const chmod = require('gulp-chmod');
const minifyCSS = require('gulp-clean-css');
const clone = require('gulp-clone');
const concat = require('gulp-concat');
const concatCSS = require('gulp-concat-css');
const dedupe = require('gulp-dedupe');
const flatten = require('gulp-flatten');
const header = require('gulp-header');
const gulpif = require('gulp-if');
const less = require('gulp-less');
const plumber = require('gulp-plumber');
const print = require('gulp-print');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const uglify = require('gulp-uglify');
const requireDotFile = require('require-dot-file');
const runSequence = require('run-sequence');

const config = require('../config/project/config');
const defaults = require('../config/defaults');
const install = require('../config/project/install');
const tasks = require('../config/tasks');
const banner = tasks.banner;
const comments = tasks.regExp.comments;
const log = tasks.log;
const settings = tasks.settings;
const filenames = tasks.filenames;

const orgs = requireDotFile(`organizations.json`, __dirname).orgs;

module.exports = function(callback) {
    orgs.forEach(org => {
        const userConfig = requireDotFile(`semantic.${org}.json`, __dirname);
        const gulpConfig = (!userConfig) ? extend(true, {}, defaults) : extend(false, {}, defaults, userConfig);
        const compiledConfig = config.addDerivedValues(gulpConfig);
        const globs = compiledConfig.globs;
        const assets = compiledConfig.paths.assets;
        const output = compiledConfig.paths.output;
        const source = compiledConfig.paths.source;

        const cssExt = { extname: `.${org}.css` };
        const minCssExt = { extname: `.${org}.min.css` };

        gulp.task(`package uncompressed css ${org}`, function() {
            return gulp.src(`${output.uncompressed}/**/${globs.components}.${org}${globs.ignored}.css`)
            .pipe(replace(assets.uncompressed, assets.packaged))
            .pipe(concatCSS(`semantic.${org}.css`, settings.concatCSS))
                .pipe(gulpif(compiledConfig.hasPermission, chmod(compiledConfig.permission)))
                .pipe(header(banner, settings.header))

        gulp.task(`package compressed css ${org}`, function() {
            return gulp.src(`${output.uncompressed}/**/${globs.components}.${org}${globs.ignored}.css`)
            .pipe(replace(assets.uncompressed, assets.packaged))
            .pipe(concatCSS(`semantic.${org}.min.css`, settings.concatCSS))
                .pipe(gulpif(compiledConfig.hasPermission, chmod(compiledConfig.permission)))
                .pipe(header(banner, settings.header))
        let tasksCompleted = 0;
        let maybeCallback  = function() {
            if(tasksCompleted === 2 * orgs.length) {
        let stream;
        let compressedStream;
        let uncompressedStream;'Building CSS');

        if( !install.isSetup() ) {
            console.error('Cannot build files. Run "gulp install" to set-up Semantic');

        // unified css stream
        stream = gulp.src(source.definitions + '/**/' + globs.components + '.less')
            .pipe(replace(, comments.variables.out))
            .pipe(replace(, comments.license.out))
            .pipe(replace(, comments.large.out))
            .pipe(replace(, comments.small.out))
            .pipe(replace(, comments.tiny.out))

        // two concurrent streams from same source to concat release
        uncompressedStream = stream.pipe(clone());
        compressedStream   = stream.pipe(clone());

        // uncompressed component css
            .pipe(replace(assets.source, assets.uncompressed))
            .pipe(gulpif(compiledConfig.hasPermission, chmod(compiledConfig.permission)))
            .on('end', function() {
              runSequence(`package uncompressed css ${org}`, maybeCallback);

        // compressed component css
            .pipe(replace(assets.source, assets.compressed))
            .pipe(gulpif(compiledConfig.hasPermission, chmod(compiledConfig.permission)))
            .on('end', function() {
            runSequence(`package compressed css ${org}`, maybeCallback);

When I inspect the configs, they seem to be correct, but the themes don’t seem to get applied. I changed one of the themes to use the ‘amazon’ buttons and anther to use the ‘github’ buttons, but when I inspect the output css, they are the same and seem to have neither theme applied.

Any help would be greatly appreciated!!!