Skip to content

Commit

Permalink
Moving over examples from rendrjs/rendr repo
Browse files Browse the repository at this point in the history
  • Loading branch information
spikebrehm committed Jun 19, 2014
1 parent 957fe95 commit 2d12b2f
Show file tree
Hide file tree
Showing 317 changed files with 8,041 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Expand Up @@ -23,3 +23,17 @@ build/Release
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
*/node_modules

# Vim
*.sw?

# Mac stuff
.DS_Store

# Build files
**/compiledTemplates.js
*/public/mergedAssets.js
*/public/testBundle.js
*/public/styles.css
*/public/js/*
127 changes: 127 additions & 0 deletions 00_simple/Gruntfile.js
@@ -0,0 +1,127 @@
var path = require('path');

var stylesheetsDir = 'assets/stylesheets';

module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

stylus: {
compile: {
options: {
paths: [stylesheetsDir],
'include css': true
},
files: {
'public/styles.css': stylesheetsDir + '/index.styl'
}
}
},

handlebars: {
compile: {
options: {
namespace: false,
commonjs: true,
processName: function(filename) {
return filename.replace('app/templates/', '').replace('.hbs', '');
}
},
src: "app/templates/**/*.hbs",
dest: "app/templates/compiledTemplates.js",
filter: function(filepath) {
var filename = path.basename(filepath);
// Exclude files that begin with '__' from being sent to the client,
// i.e. __layout.hbs.
return filename.slice(0, 2) !== '__';
}
}
},

watch: {
scripts: {
files: 'app/**/*.js',
tasks: ['browserify'],
options: {
interrupt: true
}
},
templates: {
files: 'app/**/*.hbs',
tasks: ['handlebars'],
options: {
interrupt: true
}
},
stylesheets: {
files: [stylesheetsDir + '/**/*.styl', stylesheetsDir + '/**/*.css'],
tasks: ['stylus'],
options: {
interrupt: true
}
}
},

browserify: {
options: {
debug: true,
alias: [
'node_modules/rendr-handlebars/index.js:rendr-handlebars'
],
aliasMappings: [
{
cwd: 'app/',
src: ['**/*.js'],
dest: 'app/'
}
],
shim: {
jquery: {
path: 'assets/vendor/jquery-1.9.1.min.js',
exports: '$'
}
}
},
app: {
src: [ 'app/**/*.js' ],
dest: 'public/mergedAssets.js'
},
tests: {
src: [
'test/helper.js',
'test/app/**/*.js'
],
dest: 'public/testBundle.js'
}
}
});

grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-handlebars');
grunt.loadNpmTasks('grunt-contrib-stylus');
grunt.loadNpmTasks('grunt-contrib-watch');

grunt.registerTask('runNode', function () {
grunt.util.spawn({
cmd: 'node',
args: ['./node_modules/nodemon/nodemon.js', 'index.js'],
opts: {
stdio: 'inherit'
}
}, function () {
grunt.fail.fatal(new Error("nodemon quit"));
});
});


grunt.registerTask('compile', ['handlebars', 'browserify', 'stylus']);

// Run the server and watch for file changes
grunt.registerTask('server', ['compile', 'runNode', 'watch']);

// Default task(s).
grunt.registerTask('default', ['compile']);

};

0 comments on commit 2d12b2f

Please sign in to comment.