Sha256: 6c92e3a1d21ebc558ecf25779bb11817126f48e15e9d614227dd17ebb56e9257

Contents?: true

Size: 1.36 KB

Versions: 6

Compression:

Stored size: 1.36 KB

Contents

// Script to process all the less files and convert them to CSS files
// Run from themes/dijit/claro like:
//
//	$ node compile.js

var fs = require('fs'),		// file system access
	path = require('path'),	// get directory from file name
	less = require('../../../util/less');	// less processor

var options = {
	compress: false,
	optimization: 1,
	silent: false
};

var allFiles = [].concat(
		fs.readdirSync("."),
		fs.readdirSync("form").map(function(fname){ return "form/"+fname; }),
		fs.readdirSync("layout").map(function(fname){ return "layout/"+fname; })
	),
	lessFiles = allFiles.filter(function(name){ return name && name != "variables.less" && /\.less$/.test(name); });

lessFiles.forEach(function(fname){
	console.log("=== " + fname);
	fs.readFile(fname, 'utf-8', function(e, data){
		if(e){
			console.error("lessc: " + e.message);
			process.exit(1);
		}

		new(less.Parser)({
			paths: [path.dirname(fname)],
			optimization: options.optimization,
			filename: fname
		}).parse(data, function(err, tree){
			if(err){
				less.writeError(err, options);
				process.exit(1);
			}else{
				try{
					var css = tree.toCSS({ compress: options.compress }),
						outputFname = fname.replace('.less', '.css');
					var fd = fs.openSync(outputFname, "w");
					fs.writeSync(fd, css, 0, "utf8");
				}catch(e){
					less.writeError(e, options);
					process.exit(2);
				}
			}
		});
	});
});

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
dijit-rails-0.14.0 vendor/assets/javascripts/dijit/themes/claro/compile.js
dojo-rails-0.9.4 vendor/assets/javascripts/dijit/themes/claro/compile.js
dojo-rails-0.9.3 vendor/assets/javascripts/dijit/themes/claro/compile.js
dojo-rails-0.9.2 vendor/assets/javascripts/dijit/themes/claro/compile.js
dojo-rails-0.9.1 vendor/assets/javascripts/dijit/themes/claro/compile.js
dojo-rails-0.9.0 vendor/assets/javascripts/dijit/themes/claro/compile.js