Skip to content

Commit

Permalink
browserify
Browse files Browse the repository at this point in the history
  • Loading branch information
jevets committed Aug 18, 2015
1 parent 43d092a commit 706b25c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules
*.log
secrets.*

public/assets/fonts/*
public/assets/fonts/*
public/assets/js/bundle.js
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
"scripts": {
"serve": "node index.js serve",
"build": "npm run copy-fonts && node index.js build",
"copy-fonts": "cp -R node_modules/font-awesome/fonts node_modules/bootstrap/fonts public/assets"
"build-js": "browserify public/assets/js/app.js -o public/assets/js/bundle.js",
"watch-js": "watchify public/assets/js/app.js -o public/assets/js/bundle.js -dv",
"copy-fonts": "cp -R node_modules/font-awesome/fonts node_modules/bootstrap/fonts public/assets",
"dev": "npm run copy-fonts && npm run build-js && npm run watch-js & npm run serve"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions public/_layouts/_footer.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
footer
.container.text-center
hr
p: small.legal © #{ new Date().getFullYear() } #{ site.name }
4 changes: 3 additions & 1 deletion public/_layouts/main.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ block append head

block body
include _navbar
block main
block main
include _footer
script(src='/assets/js/bundle.js')
18 changes: 18 additions & 0 deletions public/assets/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
global.jQuery = require('jquery');
global.$ = jQuery;
require('bootstrap');

var moment = require('moment');
var _ = require('underscore');


var App = {};

App.init = function() {
console.log('App.init() from /assets/js/bundle.js');
console.log( 'moment is working: ', moment().format('MMMM Do YYYY, h:mm:ss a') );
};

$(document).ready(function() {
App.init();
});
12 changes: 11 additions & 1 deletion public/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ block container
- [Font Awesome](http://fortawesome.github.io/Font-Awesome/)
- **Support for using external libraries in templates:**
- [Moment.js](http://momentjs.com/)
- [Underscore](http://underscorejs.org/)
- [Underscore.js](http://underscorejs.org/)
- Easily add your own!

## Local Development Server

- Copies fonts from bootstrap and font-awesome
- Watches `assets/js/app.js` for changes and recompiles to `assets/js/bundle.js`
- Serves via `harp server`

```shell
npm run dev
```

## Build

```shell
Expand Down

0 comments on commit 706b25c

Please sign in to comment.