Creates a styles.css and a main.js file for the report
@param {string} currWorkingDir The current working directory
343847
function buildScriptsAndStyleFiles(outputPath) {
	const stylesRegex = /<style>|<\/style>/gi,
		scriptsRegex = /<script type="text\/javascript">|<\/script>/gi;

	// creates the report directory if it doesn't exist
	if (!fs.existsSync(outputPath)) {
		fs.mkdirSync(outputPath);
	}

	// create the styles.css and main.js files
	writeFile(`${outputPath}styles.css`, styles(), stylesRegex);
	writeFile(`${outputPath}main.js`, scripts(), scriptsRegex);
}
400374
function (source, options, verbose) {
    var cwd = new WorkingDirectory(), script;

    if ( 'string' === typeof source ) {
        /* Get start time */
        var pfstart = new Date().getTime();
        var stats, files;

        /* Try to get directory/file stats */
        try {
            stats = fs.statSync('./' + source);

            if ( stats.isDirectory() ) {
                /* Log in verbose */
                if ( verbose ) {
                    console.log(cl.blue.bold.italic('Sources is solved as directory.'));
                    console.log(cl.blue.bold.italic('Importing all files and folders inside ')
                    + cl.yellow.bold(source + '/'));
                }

                files = fs.readdirSync('./' + source);

                if ( files && files.length > 0 ) {
                    var scripts = '', result;

                    files.forEach(function (file, i) {
                        var scr = imports(source.replace(/\/$/, '') + '/' + file, options, verbose);

                        if ( scr ) {
                            scripts += scr.text;

                            if ( i == 0 ) {
                                result = scr;
                            }
                        }
                    });

                    if ( result ) {
                        result.text = scripts;

                        return result;
                    }
                }
            }
        }
        catch ( err ) {
            /* Try to search files if file/folder is not exist at all */
            /* Log in verbose */
            if ( verbose ) {
                console.log(cl.magenta.bold.italic('Can\'t resolve ')
                + cl.yellow.bold(source));

                console.log(cl.blue.bold.italic('Searching ')
                + cl.yellow.bold(source + '*'));
            }

            var find = gl.sync(source + '*');

            if ( find && find.length > 0 ) {
                var flist = '';

                find.forEach(function (file, i) {
                    flist += file + (i < flist.length ? ', ' : '');
                });

                if ( verbose ) {
                    console.log(cl.blue.bold.italic('Found ') + cl.yellow.bold(flist));
                }

                if ( find.length == 1 ) {
                    return imports(find[ 0 ], options, verbose);
                }

                else if ( find.length > 1 ) {
                    var scripts = '', result;

                    find.forEach(function (file, i) {
                        var scr = imports(file, options, verbose);

                        if ( scr ) {
                            scripts += scr.text;

                            if ( i == 0 ) {
                                result = scr;
                            }
                        }
                    });

                    if ( result ) {
                        result.text = scripts;

                        return result;
                    }
                }
            }
        }

        /* Ensure no error when options undefined */
        options = !options ? {} : options;

        /* Getting Options */
        var opt = {
            exec  : options.exec === undefined ? true : options.exec,
            async : options.async === undefined ? false : options.async,

            export        : options.export === undefined ? false : options.export,
            exportDir     : options.exportDir || pc.cwd() + '/' + pt.dirname(source) + '/export',
            exportMin     : options.exportMin === undefined ? true : options.exportMin,
            exportMap     : options.exportMap === undefined ? true : options.exportMap,
            exportOptions : options.exportOptions || undefined,
            beautify      : options.beautify === undefined ? true : options.beautify,
            formatter     : options.formatter === undefined ? null : options.formatter,
            noscript      : options.noscript === undefined ? false : options.noscript
        }

        /* If scripts should be executed */
        if ( opt.exec ) {
            /* If execute in async mode */
            if ( opt.async ) {
                script = new InlineScript(cwd, source, true, verbose);
            }

            /* If execute in sync */
            else {
                script = new InlineScript(cwd, source, false, verbose);
                script.run();
            }
        }

        /* If no execute */
        else {
            script = new InlineScript(cwd, source, false, verbose);
        }

        /* If export the imported scripts */
        if ( opt.export ) {
            var expfile = opt.exportDir.replace(/\/$/, '') + '/' + script.filename;

            if ( verbose ) {
                console.log(cl.blue('\nExporting to ') + cl.yellow.bold(expfile));
            }

            /* Touch Target File */
            fe.ensureFileSync(expfile);

            /* Create Formatter */
            var format;

            /* If formatter is defined and is function, use it. Else use javascript formatter */
            if ( opt.formatter && 'function' == typeof opt.formatter ) {
                format = opt.formatter;
            }
            else {
                format = bt;
            }

            /* Create script text */
            var scripttext = script.text;

            /* If should be beautified, beautify it. Else let it as is. */
            if ( opt.beautify ) {
                scripttext = format(script.text, {
                    indent_size               : 4,
                    space_after_anon_function : true,
                });

                /* Reduce too long line */
                scripttext = scripttext.replace(/[\n\r]{3}/g, '\r\n\r\n');
            }

            /* If this is javascript, append namespace worker since namespace only support for javascript */
            if ( !opt.noscript ) {
                scripttext = nspcons + scripttext;
            }

            /* Write script to target file */
            fs.writeFileSync(expfile, scripttext);

            /* If uglify */
            if ( opt.exportMin ) {
                var ugfile = opt.exportDir.replace(/\/$/, '') + '/' + pt.basename(script.file, '.js'), uglified;
                var ugfmap = ugfile + '.map';

                /* If export sourcemap file */
                if ( opt.exportMap ) {
                    /* If using custom options */
                    if ( opt.exportOptions ) {
                        uglified = ug.minify(expfile, opt.exportOptions);
                    }
                    /* If not using custom options */
                    else {
                        uglified = ug.minify(expfile, {
                            outSourceMap : pt.basename(script.file, '.js') + '.min.map'
                        });
                    }
                }

                /* If only uglify scripts */
                else {
                    if ( opt.exportOptions ) {
                        uglified = ug.minify(expfile, opt.exportOptions);
                    }
                    else {
                        uglified = ug.minify(expfile);
                    }
                }

                if ( verbose ) {
                    console.log(cl.blue('Exporting minified version to ') + cl.yellow.bold(ugfile + '.min.js'));
                }

                /* Write minified version to file. */
                fe.ensureFileSync(ugfile + '.min.js');
                fs.writeFileSync(ugfile + '.min.js', uglified.code);

                if ( opt.exportMap ) {
                    if ( verbose ) {
                        console.log(cl.blue('Exporting sourcemap to ') + cl.yellow.bold(ugfile + '.min.map'));
                    }

                    var txtMap = JSON.parse(uglified.map);
                    txtMap.sources[ 0 ] = script.filename;

                    /* Write sourcemap file */
                    fe.ensureFileSync(ugfile + '.min.map');
                    fs.writeFileSync(ugfile + '.min.map', JSON.stringify(txtMap));
                }
            }
        }

        var pfends = new Date().getTime();
        var pfcoun = (pfends - pfstart);
        pfcoun = pfcoun < 1000 ? pfcoun + 'ms' : (pfcoun / 1000) + 's';

        if ( verbose ) {
            console.log(cl.blue('\nImport finished in ') + cl.magenta.bold(pfcoun));
        }

        return script;
    }
}
1230121
def install_custom_css( destdir, cssfile, resource=PKGNAME ):
    
    ensure_dir_exists( destdir )
    custom = os.path.join( destdir, 'custom.css' )
    prefix = css_frame_prefix(resource)

    # Check if custom.css already includes it. If so, let's remove it first
    exists = False
    if os.path.exists( custom ):
        with io.open(custom) as f:
            for line in f:
                if line.find( prefix ) >= 0:
                    exists = True
                    break
    if exists:
        remove_custom_css( destdir, resource )

    # Fetch the CSS file
    cssfile += '.css'
    data = pkgutil.get_data( resource, os.path.join('resources',cssfile) )
    # get_data() delivers encoded data, str (Python2) or bytes (Python3)

    # Add the CSS at the beginning of custom.css
    # io.open uses unicode strings (unicode in Python2, str in Python3)
    with io.open(custom + '-new', 'wt', encoding='utf-8') as fout:
        fout.write( u'{}START ======================== */\n'.format(prefix))
        fout.write( data.decode('utf-8') )
        fout.write( u'{}END ======================== */\n'.format(prefix))
        if os.path.exists( custom ):
            with io.open( custom, 'rt', encoding='utf-8' ) as fin:
                for line in fin:
                    fout.write( unicode(line) )
    os.rename( custom+'-new',custom)
527833
function mainTask() {
        options = this.options(defaultOptions);
        var target = this.target;

        this.files.forEach(function (file) {

            var destJson = app.path.join(file.dest, target + '.cssstats.json');
            var destHtml = app.path.join(file.dest, target + '.cssstats.html');

            var css = {
                concat: ''
            };

            css.concat = file.src.filter(function (filepath) {
                // Remove nonexistent files (it's up to you to filter or warn here).
                if (!grunt.file.exists(filepath)) {
                    grunt.log.warn('Source file "' + filepath + '" not found.');
                    return false;
                } else {
                    return true;
                }
            }).map(function (filepath) {
                // Read and return the file's source.

                css[filepath] = app.fs.readFileSync(filepath, 'utf8');

                return '/****\n    source: ' + filepath + '\n****/\n\n' + css[filepath];

            }).join('\n');

            var stats = parseStats(css);

            if (options.logConsole) {
                console.log(stats);
            }

            if (options.jsonOutput) {
                var statsString = JSON.stringify(stats, undefined, 4);
                grunt.file.write(destJson, statsString);
            }

            if (options.htmlOutput) {
                var output = app.parseHtml(app, options, stats, css);
                grunt.file.write(destHtml, output);
            }
        });

    }
1105280
function makeServeMiddleware(/* config */) {
  return function handle(req, resp, next) {
    if (/^\/.*\.css$/.test(req.url)) {
      resp.end("");
    }
    else {
      next();
    }
  };
}
486975
function checkWorkingDir(workingDir, cb) {
  fs.stat(workingDir, function(err, stats) {
    var errMessage;
    if (err) {
      errMessage = "The directory " + workingDir + " does not exist.";
      logger.error(errMessage);
      return cb(errMessage);
    }

    //Checking that it is a directory
    if (!stats.isDirectory()) {
      errMessage = "Expected " + workingDir + " to be a directory";
      logger.error(errMessage);
      return cb(errMessage);
    }

    return cb();
  });
}
126882
function sassCompile() {
    gulp.src(sassSrcFiles)
    .pipe(sourcemaps.init())
    .pipe(sass(sassOptions).on('error', sass.logError))
    .pipe(autoprefixer(autoprefixerOptions))
    .pipe(sourcemaps.write('./maps'))
    .pipe(gulp.dest('./dist/crudl-ui/css'))
}
1202345
function copyCss() {
  return gulp.src(['./src/assets/stylesheets/*.css'], {base: './src/assets/stylesheets'})
    .pipe(gulp.dest(function (file) {
      return libraryDist + '/dist/css' + file.base.slice(__dirname.length); // save directly to dist
    }));
}
833422
function createDir(dir) {
  const splitPath = dir.split('/');
  splitPath.reduce((path, subPath) => {
    let currentPath;
    if(subPath != '.'){
      currentPath = path + '/' + subPath;
      if (!fs.existsSync(currentPath)){
        fs.mkdirSync(currentPath);
      }
    }
    else{
      currentPath = subPath;
    }
    return currentPath
  }, '')
}
897361
def build!
      create_output_directory
      spec.source_directories.each { |d| simple_compile_directory(d) }
      compile_files(spec.all_javascript_paths)
      compile_files(spec.all_stylesheet_paths)
      write_manifest
    end
808320
function getOutputFile(file, outputDir) {
  const fileName = path.basename(file).replace('.scss', '.css');
  return path.join(outputDir, fileName);
}
314685
function cssnext() {
  const plugins = [
    require('postcss-import'),
    require('postcss-base64')({
      extensions: ['.svg'],
      root: __dirname + '/src/components/'
    }),
    cssnextPlugin({
      browsers: babelrc.presets[0][1].targets.browsers,
    }),
    reporter({
      clearAllMessages: true,
      clearReportedMessages: true,
      throwError: false
    })
  ];

  return gulp.src('src/{*-,}onsen-css-components.css', cwdOption)
    //.pipe(plumber()) // this was causing the task to never complete with gulp 4, but why...?
    .pipe(postcss(plugins))
    //.pipe(gulp.dest('./build/'))
    .pipe(gulp.dest(prefix))
    .pipe(browserSync.stream());
}
165622
def setup
      FileUtils.makedirs([css_dir, image_dir, js_dir])
      FileUtils.cp(@theme.filename, File.join(css_dir, 'coco.css'))
      FileUtils.cp(@img_files, image_dir)
      FileUtils.cp(File.join(Coco::ROOT, 'template/js/coco.js'), js_dir)
    end
1265869
function workTextFiles() {
        return indexFiles().concat(srcFiles()).concat(allTestFiles()).concat(otherJsFiles()).concat(otherNonJsFiles()).concat(taskFiles()).concat(cssFiles())
            .concat(toolsShellFiles()).concat(commonJsFiles()).concat(htmlTemplateFiles()).concat(pythonFiles()).concat(textDataFiles());
    }
403659
function buildCSS(src, filename, dest, applyHeader) {
  dest = dest || config.dist.cssPath;
  applyHeader = applyHeader || false;

  return gulp.src(src)
    .pipe(sass({
      includePaths: [config.src.scssPath, config.packagesPath]
    })
      .on('error', sass.logError))
    .pipe(cleanCSS())
    .pipe(autoprefixer({
      // Supported browsers added in package.json ("browserslist")
      cascade: false
    }))
    .pipe(gulpif(applyHeader, header(config.prj.header, {
      config: config
    })))
    // Remove charset rule (if present) and add to the first
    // line of the stylesheet (@charset must be on the first line)
    .pipe(replace('@charset "UTF-8";', ''))
    .pipe(header('@charset "UTF-8";\n'))
    .pipe(rename(filename))
    .pipe(gulp.dest(dest));
}
540410
function check(directory, options) {
  var deferred = q.defer();

  var dir = path.resolve(process.cwd(), directory);
  util.info("\nSetting up in %s%s%s:", c.bldcyn, dir, c.txtrst);

  // **data**: All the markdown / yaml files.
  var dataPath =  path.resolve(dir, options.templates || "data");
  // **template**: All the Pug files.
  var templatePath =  path.resolve(dir, options.templates || "templates");
  // **output**: Static directory that includes HTML files.
  var outputPath =  path.resolve(dir, options.output || "public");
  // **css/js**: Additional directories that are created in the output directory.
  var cssPath =  path.resolve(dir, options.output || "public", "css");
  var jsPath =  path.resolve(dir, options.output || "public", "js");

  util.info("  %s%s", c.bldwht, dir); // Markade root directory
  util.info("  %s%s", c.bldwht, dataPath);
  util.info("  %s%s", c.bldwht, templatePath);
  util.info("  %s%s", c.bldwht, outputPath);
  util.info("  %s%s", c.bldwht, cssPath);
  util.info("  %s%s%s", c.bldwht, jsPath, c.txtrst);

  var json = {
    data: dataPath,
    template: templatePath,
    output: outputPath,
    css: cssPath,
    js: jsPath,
    root: dir
  };

  // And a confirmation is asked in the command line.
  rl.question("\n» Is that okay? ["+c.bldylw+"yes"+c.txtrst+"] " , function(answer) {
    if (answer == "y" || answer == "yes" || answer == "sure" || answer == "yup")
      deferred.resolve(json);
    else if (typeof answer == "undefined" || answer.length === 0)
      deferred.resolve(json);
    else {
      deferred.reject(false);
    }
  });

  return deferred.promise;
}
1193407
function createOutputFolder(next) {
    var defPath         = path.join(getConfig('output.folder'), 'definition-files'),
        defPathCustom   = path.join(getConfig('output.folder'), 'definition-files-custom');

    fs.remove(defPath, function (err) {
        if (err) { next(err); }
        fs.createFile(path.join(defPath, '_Dont_add_or_edit_any_files'), function (err) {
            if (err) { next(err); }
            fs.mkdirs(defPathCustom, function (err) {
                if (err) { next(err); }
                next(null);
            });
        });
    });
}