Permalink
Browse files

Update npm dependencies

  • Loading branch information...
sachalifs committed Nov 28, 2014
1 parent 2634201 commit 1d55f168f3b4cbf796d377bfb5f394c9a21995c9
Showing with 201 additions and 228 deletions.
  1. +3 −7 bin/njs-build
  2. +2 −2 lib/boot/index.jade
  3. +52 −52 lib/boot/index.styl
  4. +100 −0 lib/build/builder.js
  5. +5 −30 lib/build/index.js
  6. +0 −102 lib/build/jade.js
  7. +1 −1 lib/build/stylus.js
  8. +14 −12 lib/setup/index.js
  9. +24 −22 package.json
View
@@ -4,7 +4,7 @@
* Module dependencies.
*/
var build = require('../lib/build');
var Builder = require('../lib/build').Builder;
var fs = require('fs');
var write = fs.writeFileSync;
var path = require('path');
@@ -13,9 +13,5 @@ var resolve = path.resolve;
// Little hack to include `NODE_PATH=.`
// require('node-path')(module, [resolve('.')]);
var builder = build.createBuilder();
builder.build(function(err, res) {
if (err) return console.log(err);
write('public/app.js', res.require + res.js);
write('public/app.css', res.css);
});
var builder = new Builder();
builder.build();
View
@@ -1,4 +1,4 @@
!!! 5
doctype html
html
head
title NodeJS Starter
@@ -11,4 +11,4 @@ html
script(src='/app.js')
script.
require('boot')
require('./lib/boot')
View
@@ -1,64 +1,64 @@
body
background: url('/boot/images/bg.jpg') top center fixed;
background-size: cover;
-webkit-font-smoothing: antialiased;
font-family: "Lucida Grande";
background url('images/bg.jpg') top center fixed
background-size cover
-webkit-font-smoothing antialiased
font-family "Lucida Grande"
h1,h2,h3
font-weight: 100;
font-weight 100
a
font-weight: bold
a
font-weight bold
.btn
letter-spacing: 2px;
text-transform: uppercase
.btn
letter-spacing 2px
text-transform uppercase
header
h1
font-size: 60px;
margin: 50px 0 30px 0;
h5
font-size: 11px;
font-style: italic
opacity: .6
a
font-weight: normal
header
h1
font-size 60px
margin 50px 0 30px 0
h5
font-size 11px
font-style italic
opacity .6
a
font-weight normal
.site-content
max-width: 650px;
padding: 30px 50px;
margin: 30px auto;
background: white;
max-width 650px
padding 30px 50px
margin 30px auto
background white
.description
font-size: 18px;
line-height: 26px;
margin-bottom: 30px;
h4
margin-top: 30px;
.social-login
.btn
margin-right: 20px;
font-size: 11px;
font-size 18px
line-height 26px
margin-bottom 30px
h4
margin-top 30px
.social-login
.btn
margin-right 20px
font-size 11px
a.btn.btn-get-started
border: 0;
background: white;
color: black;
font-size: 12px;
padding: 20px 30px;
border 0
background white
color black
font-size 12px
padding 20px 30px
pre.code-box
text-align: left;
border: 0;
padding: 20px;
border-radius: 0;
margin-top: 20px;
h5
margin-top: 0;
p
padding-left: 0;
.share-links
iframe
margin-right: 20px;
text-align left
border 0
padding 20px
border-radius 0
margin-top 20px
h5
margin-top 0
p
padding-left 0
.share-links
iframe
margin-right 20px
View
@@ -0,0 +1,100 @@
/**
* Module dependencies.
*/
var resolve = require('component-resolver');
var build = require('component-builder');
var stylus = require('./stylus');
var jade = require('builder-jade');
var mkdir = require('mkdirp');
var fs = require('fs');
var write = fs.writeFileSync;
var ready = require('ready').mixin;
/**
* Constructor
*/
function Builder() {
var self = this;
resolve(process.cwd(), {
// install the remote components locally
install: false,
root: 'public'
}, function (err, tree) {
if (err) console.log(err), process.exit(1);
self.tree = tree;
self.ready(true);
});
}
/**
* Add ready mixin
*/
ready(Builder.prototype);
/**
* Write app.js, app.css and copy assets
*
* @param fn callback receiving error, if any
*/
Builder.prototype.build = function(fn) {
var self = this;
this.ready(onready);
function onready() {
mkdir('public');
build.scripts(self.tree)
.use('scripts', build.plugins.js())
.use('json', build.plugins.json())
.use('templates', jade({
string: false,
runtime: true
}))
.use('templates', build.plugins.string())
.end(onscriptsend);
function onscriptsend(err, js) {
if (err) {
if (fn) return fn(err);
throw err;
}
write('public/app.js', build.scripts.require + jade.runtime + js);
build.styles(self.tree)
.use('styles', build.plugins.css())
.use('styles', stylus())
.use('styles', build.plugins.urlRewriter(''))
.end(onstylesend);
}
function onstylesend(err, string) {
if (err) {
if (fn) return fn(err);
throw err;
}
fs.writeFileSync('public/app.css', string);
build.files(self.tree, {destination: 'public'})
.use('images', build.plugins.copy())
.use('files', build.plugins.copy())
.end(onfilesend);
}
function onfilesend(err) {
debugger;
if (fn) return fn(err);
if (err) throw err;
}
}
};
module.exports = Builder;
View
@@ -2,19 +2,15 @@
* Module dependencies.
*/
var Builder = require('component-builder');
var stylus = require('component-stylus-plugin');
var jade = require('./jade');
var fs = require('fs');
var write = fs.writeFileSync;
var Builder = require('./builder');
var debug = require('debug')('njs:build');
/**
* Expose component
* builder getter
*/
module.exports.createBuilder = createBuilder;
module.exports.Builder = Builder;
/**
* Expose component
@@ -23,22 +19,6 @@ module.exports.createBuilder = createBuilder;
module.exports.middleware = middleware;
/**
* Creates a `Builder` instance
* ready for build
*/
function createBuilder () {
var builder = new Builder('.');
builder.copyFiles();
builder.addLookup('lib');
builder.copyAssetsTo('public');
builder.use(jade);
builder.use(stylus);
return builder;
}
/**
* Express build middleware
*/
@@ -51,13 +31,8 @@ function middleware (req, res, next) {
debug('Build %s.', req.path);
var builder = createBuilder();
builder.build(function(err, res){
if (err) return next(err);
debug('Write script and stylesheet');
write('public/app.js', res.require + res.js);
write('public/app.css', res.css);
next();
var builder = new Builder();
builder.build(function(err){
next(err);
});
};
Oops, something went wrong.

0 comments on commit 1d55f16

Please sign in to comment.