Skip to content
Myr

Merge pull request #1073 from Zoramite/lessMiddleware

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Adding support back in for less CSS.

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 377677c, 4c1afb2 · Browse files · 1 file+20 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+20 added−10 removed

  • other:+20 added−10 removed

1 file+20 added−10 removed

modified:bin/express+20 added-10 removed
16 unmodified lines
17 .version(express.version)18 .option('-s, --sessions', 'add session support')19 .option('-e, --ejs', 'add ejs engine support (defaults to jade)')20 .option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')21 .option('-S, --stylus', 'add stylus support')21 .option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')22 .option('-f, --force', 'force on non-empty directory')23 .parse(process.argv);2425// Path
9 unmodified lines
35program.template = 'jade';36if (program.ejs) program.template = 'ejs';37if (program.jshtml) program.template = 'jshtml';3839// Stylesheet engine4041program.css = program.stylus42 ? 'stylus'43 : null;4439/**40 * Routes index template.41 */42
139 unmodified lines
182 , 'app.configure(function(){'183 , ' app.set(\'views\', __dirname + \'/views\');'184 , ' app.set(\'view engine\', \':TEMPLATE\');'185 , ' app.use(express.favicon());'192 , ' app.use(express.logger(\'dev\'));'186 , ' app.use(express.logger(\'dev\'));{css}'187 , ' app.use(express.static(__dirname + \'/public\'));'188 , ' app.use(express.bodyParser());'195 , ' app.use(express.methodOverride());{sess}{css}'189 , ' app.use(express.methodOverride());{sess}'190 , ' app.use(app.router);'191 , '});'192 , ''193 , 'app.configure(\'development\', function(){'
50 unmodified lines
244 mkdir(path + '/public/javascripts');245 mkdir(path + '/public/images');246 mkdir(path + '/public/stylesheets', function(){247 switch (program.css) {248 case 'less':249 write(path + '/public/stylesheets/style.less', less);250 break;251 case 'stylus':252 write(path + '/public/stylesheets/style.styl', stylus);253 break;254 default:
23 unmodified lines
278 });279280 // CSS Engine support281 switch (program.css) {282 case 'less':283 app = app.replace('{css}', eol + ' app.use(require(\'less-middleware\')({ src: __dirname + \'/public\' }));');284 break;285 case 'stylus':286 app = app.replace('{css}', eol + ' app.use(require(\'stylus\').middleware({ src: __dirname + \'/public\' }));');287 break;288 default:
18 unmodified lines
307 express: express.version308 }309 }310311 if (program.css) pkg.dependencies[program.css] = '*';311 if (program.template) pkg.dependencies[program.template] = '*';312313 // CSS Engine support314 switch (program.css) {315 case 'less':316 pkg.dependencies['less-middleware'] = '*';317 break;318 default:319 if(program.css) {320 pkg.dependencies[program.css] = '*';321 }322 }323324 write(path + '/package.json', JSON.stringify(pkg, null, 2));325 write(path + '/app.js', app);326 });327}
52 unmodified lines