Permalink
Browse files

nib examples

  • Loading branch information...
clarkdave committed Dec 18, 2013
1 parent f01bc19 commit edb652bcf0f7c7fc910e9fc7181f43e07b6ad0f8
@@ -1,4 +1,4 @@
-# connect-assets Connect example
+# connect-mincer Connect example
This is an example Connect app using connect-mincer. It's much simpler than the Express example, but should show how you can use connect-mincer without Express.
@@ -1,4 +1,4 @@
-# connect-assets Express example
+# connect-mincer Express example
This is an example Express v3 app using connect-mincer. It demonstrates compiling LESS and CoffeeScript with bundles.
View
@@ -0,0 +1,3 @@
+# connect-mincer example with Stylus and nib
+
+Nothing much to see here: it's just a tiny example app which uses nib and Stylus.
View
@@ -0,0 +1,46 @@
+'use strict';
+
+var express = require('express'),
+ env = process.env.NODE_ENV,
+ ConnectMincer = require('../../')
+;
+
+var app = express();
+
+var mincer = new ConnectMincer({
+ root: __dirname,
+ production: env === 'production' || env === 'staging',
+ mountPoint: '/assets',
+ manifestFile: __dirname + '/public/assets/manifest.json',
+ paths: [
+ 'assets/images',
+ 'assets/css',
+ 'assets/js',
+ 'vendor/css',
+ 'vendor/js'
+ ]
+});
+
+mincer.Mincer.StylusEngine.configure(function(style) {
+ style.use(require('nib')());
+});
+
+app.use(mincer.assets());
+
+if (env === 'production' || env === 'staging') {
+ app.use(express.static(__dirname + '/public'));
+} else {
+ // in dev, just use the normal server which recompiles assets as needed
+ app.use('/assets', mincer.createServer());
+}
+
+app.set('port', process.env.PORT || 9000);
+app.set('view engine', 'ejs');
+
+app.get('/', function(req, res) {
+ res.render('index.ejs');
+});
+
+app.listen(app.get('port'), function() {
+ console.info('Express app started on ' + app.get('port'));
+});
@@ -0,0 +1,8 @@
+@import 'nib';
+
+global-reset();
+
+body {
+ background-color: #222;
+ color: #fff;
+}
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+<head>
+ <meta charset='utf-8'>
+ <%- css('main.css') %>
+</head>
+<body>
+ <h1>This an app</h1>
+ <p>Hello</p>
+</body>
+</html>
View
@@ -37,7 +37,9 @@
"should": "*",
"sinon": "1.6.x",
"supertest": "*",
- "cheerio": "*"
+ "cheerio": "*",
+ "stylus": "*",
+ "nib": "*"
},
"engines": {
"node": ">= 0.6.0"

0 comments on commit edb652b

Please sign in to comment.