Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: backbone-boilerplate/grunt-bbb
base: master
...
head fork: backbone-boilerplate/grunt-bbb
compare: assets
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
View
1  .gitignore
@@ -1 +0,0 @@
-node_modules
View
3  .gitmodules
@@ -1,3 +0,0 @@
-[submodule "tasks/init"]
- path = tasks/init
- url = git://github.com/backbone-boilerplate/init.git
View
1  .npmignore
@@ -1 +0,0 @@
-tasks/init/bbb/root/.git
View
76 bin/bbb
@@ -1,76 +0,0 @@
-#!/usr/bin/env node
-var grunt = require("grunt");
-
-// Preload all custom tasks.
-grunt.npmTasks([
- // Load grunt-contrib used for a majority of the tasks.
- "grunt-contrib",
- // Load grunt-jasmine-task used for testing Jasmine.
- "grunt-jasmine-task",
- // Load the remaining tasks (init/server/requirejs) from bbb.
- "bbb"
-]);
-
-// Draw the help screen.
-function displayHelp() {
- var pkg = require(__dirname + "/../package.json");
- grunt.log.writeln();
- grunt.log.writeln(pkg.description);
- grunt.log.writeln((" " + pkg.name + " ").green.inverse
- + " Version - " + pkg.version);
-
- // Borrowed heavily from the Grunt help source.
- var col1len = 0;
-
- var opts = Object.keys(grunt.cli.optlist).map(function(long) {
- var o = grunt.cli.optlist[long];
- var col1 = '--' + (o.negate ? 'no-' : '') + long + (o.short ? ', -' + o.short : '');
- col1len = Math.max(col1len, col1.length);
- return [col1, o.info];
- });
-
- var widths = [1, col1len, 2, 76 - col1len];
-
- var gruntTasks = Object.keys(grunt.task._tasks).slice(0, 8);
- var tasksList = Object.keys(grunt.task._tasks).slice(8);
-
- if (tasksList.length) {
- displayTasks("Backbone Boilerplate", tasksList);
- }
-
- if (gruntTasks.length) {
- displayTasks("Grunt", gruntTasks);
- }
-
- function displayTasks(name, tasksList) {
- var tasks = tasksList.map(function(name) {
- col1len = Math.max(col1len, name.length);
- var info = grunt.task._tasks[name].info;
-
- return [name, info.blue];
- });
-
- grunt.log.header((name + " tasks:").yellow);
- grunt.log.writeln();
-
- tasks.forEach(function(a) {
- grunt.log.writetableln(widths,
- ['', grunt.utils._.pad(a[0], col1len), '', a[1]]
- );
- });
- }
-
- grunt.log.writeln();
-}
-
-// Immediately display help screen if no arguments.
-if (process.argv.length === 2) {
- // Initialize task system so that the tasks can be listed.
- grunt.task.init([], {help: true});
-
- // Do not proceed further.
- return displayHelp();
-}
-
-// Otherwise, invoke the CLI.
-grunt.cli();
View
40 grunt.js
@@ -1,40 +0,0 @@
-module.exports = function(grunt) {
-
- // Project configuration.
- grunt.initConfig({
- test: {
- files: ["test/**/*.js"]
- },
- lint: {
- files: ["grunt.js", "tasks/**/*.js", "test/**/*.js"]
- },
- watch: {
- files: "<config:lint.files>",
- tasks: "default"
- },
- jshint: {
- options: {
- curly: true,
- eqeqeq: true,
- immed: true,
- latedef: true,
- newcap: true,
- noarg: true,
- sub: true,
- undef: true,
- boss: true,
- eqnull: true,
- node: true,
- es5: true
- },
- globals: {}
- }
- });
-
- // Load local tasks.
- grunt.loadTasks("tasks");
-
- // Default task.
- grunt.registerTask("default", "lint test");
-
-};
View
38 package.json
@@ -1,38 +0,0 @@
-{
- "name": "bbb",
- "description": "Backbone Boilerplate Build Tool",
- "version": "0.1.5",
- "homepage": "https://github.com/tbranyen/bbb",
- "author": {
- "name": "Tim Branyen (@tbranyen)",
- "email": "tim@tabdeveloper.com",
- "url": "http://tbranyen.com"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/backbone-boilerplate/grunt-bbb.git"
- },
- "bugs": {
- "url": "https://github.com/backbone-boilerplate/grunt-bbb/issues"
- },
- "dependencies": {
- "grunt": "0.3.11",
- "grunt-contrib": "0.0.8",
- "grunt-jasmine-task": "0.2.0",
-
- "requirejs": "2.0.2",
- "express": "2.5.9"
- },
- "devDependencies": {
- "grunt": "~0.3.10"
- },
- "keywords": [],
- "engines": {
- "node": ">= 0.6.0"
- },
- "main": "grunt.js",
- "bin": "bin/bbb",
- "scripts": {
- "test": "grunt test"
- }
-}
View
142 readme.md
@@ -1,142 +0,0 @@
-Backbone Boilerplate framework tool.
-
-## Getting Started ##
-
-Install this [Grunt](https://github.com/cowboy/grunt) plugin with:
-`npm install -g bbb`
-
-## Development ##
-
-If you wish to contribute or just want to install from source, simply run the
-following commands:
-
-``` bash
-# Clone the repository.
-git clone git://github.com/backbone-boilerplate/grunt-bbb.git
-
-# Change directory into it.
-cd grunt-bbb
-
-# Update all the submodules recursively.
-git submodule update --init --recursive
-
-# Allow bbb to be globally accessible.
-sudo npm link
-```
-
-## Commands ##
-
-All commands are prefixed with `bbb` in your terminal. For example the command
-`init` below would be executed like this:
-
-``` bash
-$ bbb init
-```
-
-Tasks are defined inside the grunt-bbb project, but also borrowed from other
-grunt projects: [grunt-contrib](https://github.com/gruntjs/grunt-contrib) &
-[grunt-jasmine-task](https://github.com/creynders/grunt-jasmine-task)
-
-If you have problems with borrowed tasks, please file issues on the respective
-projects.
-
-### Scaffolding ###
-
-These commands will build out files for you.
-
-#### `init` (bbb) ####
-
-Creates a bare boilerplate project.
-
-#### `init:tutorial` (bbb) ####
-
-*Run bbb init before this command*
-
-Creates a boilerplate which contains the tutorial.
-
-#### `init:todomvc` (bbb) ####
-
-*Run bbb init before this command*
-
-Creates a boilerplate which contains the TodoMVC application that utilizes
-LayoutManager.
-
-#### `init:module` (bbb) ####
-
-*Run bbb init before this command*
-
-Creates a new module in the `app/modules` directory.
-
-### Maintenence ###
-
-These commands help you maintain your project.
-
-#### `lint` (grunt) ####
-
-Ensures all your code conforms to JSHint.
-
-#### `list` (bbb) ####
-
-Shows a tree of your application's modules and dependencies.
-
-### Build ###
-
-These commmands help you build your application.
-
-#### `debug` (bbb) ####
-
-Lints all your JavaScript, compiles all your templates to JST (JavaScript
-Templates), builds your application using RequireJS build tool (figures out
-dependencies and concatenates all files), and then finally concatenates the
-templates and application together. This task also swaps out RequireJS for
-Almond (signficantly smaller filesize AMD manager).
-
-#### `release` (bbb) ####
-
-Everything that debug command does, except the final tasks here are minified
-CSS and minified JavaScript.
-
-#### `clean` (grunt-contrib) ####
-
-Removes all files inside `dist/` directory.
-
-#### `handlebars` (grunt-contrib) ####
-
-Compiles handlebars templates - *this requires setup*.
-
-#### `jst` (grunt-contrib) ####
-
-Compiles all templates as underscore template functions and outputs them to
-`dist/debug/templates.js`.
-
-#### `less` (grunt-contrib) ####
-
-Compiles LESS stylesheets.
-
-#### `mincss` (grunt-contrib) ####
-
-Minifies your CSS into `dist/release/index.css`.
-
-#### `requirejs` (bbb) ####
-
-Builds out your application using the defaults specified into the root
-`grunt.js` file.
-
-#### `server` (bbb) ####
-
-Will by default run with normal files perfect for development and debugging.
-
-##### `server:debug` (bbb) #####
-
-This command serves the same files excepts that your application is mapped to
-the `dist/debug` directory. This is mostly useful for detecting issues with the
-build, since files are not minified.
-
-##### `server:release` (bbb) #####
-
-This command will serve the same was debug except mapping to `dist/release`
-instead. This setup is how your application should be deployed.
-
-## License
-Copyright (c) 2012 Tim Branyen (@tbranyen)
-Licensed under the MIT license.
View
BIN  screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1  tasks/init
@@ -1 +0,0 @@
-Subproject commit 6ae570ecc196de7577667bbe38ce9ed683590d05
View
148 tasks/requirejs.js
@@ -1,148 +0,0 @@
-/*
- * Grunt Task File
- * ---------------
- *
- * Task: RequireJS
- * Description: Tasks for working with RequireJS.
- * Dependencies: requirejs
- *
- */
-
-module.exports = function(grunt) {
-
- // Node.js modules
- var fs = require("fs");
- var path = require("path");
- // Include requirejs
- var requirejs = require("requirejs");
- var _ = grunt.utils._;
- // Shorthand Grunt functions
- var log = grunt.log;
-
- grunt.registerTask("requirejs", "Build a RequireJS project.", function(prop) {
- var options = grunt.config("requirejs") || {};
-
- // Merge passed options into defaults
- options = _.extend({}, {
- // Do not optimize
- optimize: "none",
-
- // Show warnings
- logLevel: 2,
-
- // Ensure modules are inserted
- skipModuleInsertion: false,
- }, options);
-
- // Run the r.js helper
- grunt.helper("r.js", options, function(response) {
- // Print out response
- log.writeln(response);
- });
- });
-
- grunt.registerTask("list", "Show module dependencies", function(prop) {
- grunt.helper("list");
- });
-
- grunt.registerHelper("r.js", function(options, done) {
- requirejs.optimize(options, done);
- });
-
- grunt.registerHelper("list", function() {
- var jsRegExp = /\.js$/;
-
- requirejs.tools.useLib(function(require) {
- require(["parse"], function(parse) {
- var deps = {};
- var files = [];
-
- // Recursively find all files inside the application directory
- function recurse(dir) {
- fs.readdirSync(dir).forEach(function(name) {
- var subdir = path.resolve(dir, name);
- var stats = fs.statSync(subdir);
-
- if (stats.isDirectory()) {
- recurse(subdir);
- } else if (jsRegExp.test(name)) {
- files.push(subdir);
- }
- });
- }
-
- // Start with the app directory
- recurse("app/");
-
- files.forEach(function(name) {
- var contents = fs.readFileSync(name, "utf8");
- var prefix = process.platform === "win32" ? "app\\" : "app/";
- var shortname = name.slice(name.indexOf(prefix));
-
- deps[shortname] = parse.findDependencies(name,
- contents);
- });
-
- //console.log({ deps: deps });
- console.log(grunt.helper("tree", deps));
- });
- });
- });
-
- grunt.registerHelper("tree", function(obj) {
- var tree = [""];
-
- function spaces(len, end, start) {
- start = start || " ";
- end = end || " ";
-
- if (!start) {
- return Array(len+1).join(Array(3).join(end));
- } else {
- return Array(len+1).join(start + Array(2).join(end));
- }
- }
-
- function traverse(obj, depth) {
- _.each(obj, function(val, key) {
- var len;
-
- if (_.isArray(val)) {
- tree.push("\u251c" + spaces(depth) + " " + key);
-
- len = val.length;
-
- _.each(val, function(val, i) {
- if (_.isString(val)) {
- if (i == len-1) {
- tree.push("\u2502 " + spaces(depth+1, "\u2500", "\u2514") + " "
- + val);
- } else {
- tree.push("\u2502 " + spaces(depth+1, "\u2500", "\u251c") + " "
- + val);
- }
- } else if (_.isObject(val)) {
- traverse(obj, depth+1);
- }
- });
-
- tree.push("\u2502");
-
- } else if (_.isObject(val)) {
- tree.push(spaces(depth) + key);
- traverse(val, depth+1);
- } else {
- tree.push(spaces(depth) + key);
- }
-
- });
- }
-
- traverse(obj, 0);
-
- tree.pop();
-
- return tree.join("\n");
- });
-
-};
View
103 tasks/server.js
@@ -1,103 +0,0 @@
-/*
- * Grunt Task File
- * ---------------
- *
- * Task: Server
- * Description: Serve the web application.
- * Dependencies: express
- *
- */
-
-module.exports = function(grunt) {
-
- var _ = grunt.utils._;
- // Shorthand Grunt functions
- var log = grunt.log;
-
- grunt.registerTask("server", "Run development server.", function(prop) {
- var options;
- var props = ["server"];
-
- // Keep alive
- var done = this.async();
-
- // If a prop was passed as the argument, use that sub-property of server.
- if (prop) { props.push(prop); }
-
- // Defaults set for server values
- options = _.defaults(grunt.config(props) || {}, {
- favicon: "./favicon.ico",
- index: "./index.html",
-
- port: process.env.PORT || 8000,
- host: process.env.HOST || "127.0.0.1"
- });
-
- options.folders = options.folders || {};
-
- // Ensure folders have correct defaults
- options.folders = _.defaults(options.folders, {
- app: "./app",
- assets: "./assets",
- dist: "./dist"
- });
-
- options.files = options.files || {};
-
- // Ensure files have correct defaults
- options.files = _.defaults(options.files, {
- "app/config.js": "app/config.js"
- });
-
- // Run the server
- grunt.helper("server", options);
-
- // Fail task if errors were logged
- if (grunt.errors) { return false; }
-
- log.writeln("Listening on http://" + options.host + ":" + options.port);
- });
-
- grunt.registerHelper("server", function(options) {
- // Require libraries
- var fs = require("fs");
- var express = require("express");
- var site = express.createServer();
-
- // Map static folders
- Object.keys(options.folders).sort().reverse().forEach(function(key) {
- site.use("/" + key, function(req, res, next){
- express.static.send(req, res, next, {
- root: options.folders[key],
- path: req.url,
- getOnly: true,
-
- callback: function(err) {
- res.send(404);
- }
- });
- });
- });
-
- // Map static files
- if (_.isObject(options.files)) {
- Object.keys(options.files).sort().reverse().forEach(function(key) {
- site.get("/" + key, function(req, res) {
- return res.sendfile(options.files[key]);
- });
- });
- }
-
- // Serve favicon.ico
- site.use(express.favicon(options.favicon));
-
- // Ensure all routes go home, client side app..
- site.get("*", function(req, res) {
- fs.createReadStream(options.index).pipe(res);
- });
-
- // Actually listen
- site.listen(options.port, options.host);
- });
-
-};

No commit comments for this range

Something went wrong with that request. Please try again.