Commit
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| function config(name) { | ||
| return require('./configurations/' + name); | ||
| } | ||
|
|
||
| module.exports = function(grunt) { | ||
|
|
||
| grunt.initConfig({ | ||
| pkg: grunt.file.readJSON('package.json'), | ||
|
|
||
| clean: ["dist"], | ||
| watch: config('watch') , | ||
| concat: config('concat'), | ||
| browser: config('browser'), | ||
| connect: config('connect'), | ||
| transpile: config('transpile') | ||
| }); | ||
|
|
||
| // By default, (i.e., if you invoke `grunt` without arguments), do | ||
| // a new build. | ||
| this.registerTask('default', ['build']); | ||
|
|
||
| // Build a new version of the library | ||
| this.registerTask('build', "Builds a distributable version of the current project", [ | ||
| 'clean', | ||
| 'transpile:amd', | ||
| 'concat:library', | ||
| 'concat:browser', | ||
| 'browser:dist', | ||
| 'bytes']); | ||
|
|
||
| this.registerTask('tests', "Builds the test package", [ | ||
| 'build', | ||
| 'concat:deps', | ||
| 'transpile:tests']); | ||
|
|
||
| // Run a server. This is ideal for running the QUnit tests in the browser. | ||
| this.registerTask('server', [ | ||
| 'build', | ||
| 'tests', | ||
| 'connect', | ||
| 'watch']); | ||
|
|
||
| // Load tasks from npm | ||
| grunt.loadNpmTasks('grunt-contrib-clean'); | ||
| grunt.loadNpmTasks('grunt-contrib-concat'); | ||
| grunt.loadNpmTasks('grunt-contrib-connect'); | ||
| grunt.loadNpmTasks('grunt-contrib-watch'); | ||
| grunt.loadNpmTasks('grunt-es6-module-transpiler'); | ||
|
|
||
| grunt.task.loadTasks('tasks'); | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| module.exports = { | ||
| dist: { | ||
| src: 'tmp/<%= pkg.barename %>.browser1.js', | ||
| dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.js' | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| module.exports = { | ||
| library: { | ||
| src: ['tmp/<%= pkg.barename %>.amd.js'], | ||
| dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.amd.js' | ||
| }, | ||
|
|
||
| deps: { | ||
| src: ['vendor/deps/*.js'], | ||
| dest: 'tmp/deps.amd.js' | ||
| }, | ||
|
|
||
| browser: { | ||
| src: ['vendor/loader.js', 'tmp/<%= pkg.barename %>.amd.js'], | ||
| dest: 'tmp/<%= pkg.barename %>.browser1.js' | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| module.exports = { | ||
| server: {}, | ||
| options: { | ||
| hostname: '0.0.0.0', | ||
| port: 8000, | ||
| base: '.' | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| module.exports = { | ||
| amd: { | ||
| type: 'amd', | ||
| src: ["lib/<%= pkg.barename %>.js", "lib/*/**/*.js"], | ||
| dest: "tmp/<%= pkg.barename %>.amd.js" | ||
| }, | ||
|
|
||
| cjs: { | ||
| type: 'cjs', | ||
| src: ["lib/<%= pkg.barename %>.js", "lib/*/**/*.js"], | ||
| dest: "tmp/<%= pkg.barename %>.cjs.js" | ||
| }, | ||
|
|
||
| globals: { | ||
| type: 'globals', | ||
| src: ["lib/<%= pkg.barename %>.js", "lib/*/**/*.js"], | ||
| dest: "tmp/<%= pkg.barename %>.globals.js" | ||
| }, | ||
|
|
||
| tests: { | ||
| type: 'amd', | ||
| src: ['test/test_helpers.js', 'test/tests.js', 'test/tests/**/*_test.js'], | ||
| dest: 'tmp/tests.amd.js' | ||
| } | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| module.exports = { | ||
| files: ['lib/**', 'vendor/*', 'test/**/*'], | ||
| tasks: ['build', 'tests'] | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,19 @@ | ||
| var handlebars = require("./handlebars/base"), | ||
| import handlebars from "handlebars/base"; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
wycats
Author
Collaborator
|
||
|
|
||
| // Each of these augment the Handlebars object. No need to setup here. | ||
| // (This is done to easily share code between commonjs and browse envs) | ||
| utils = require("./handlebars/utils"), | ||
| compiler = require("./handlebars/compiler"), | ||
| runtime = require("./handlebars/runtime"); | ||
| import { SafeString, Exception, extend, escapeExpression, isEmpty } from "handlebars/utils"; | ||
| import compiler from "handlebars/compiler"; | ||
| import runtime from "handlebars/runtime"; | ||
|
|
||
| // For compatibility and usage outside of module systems, make the Handlebars object a namespace | ||
| var create = function() { | ||
| var hb = handlebars.create(); | ||
|
|
||
| utils.attach(hb); | ||
| hb.SafeString = SafeString; | ||
| hb.Exception = Exception; | ||
| hb.utils = { extend: extend, escapeExpression: escapeExpression, isEmpty: isEmpty }; | ||
|
|
||
| compiler.attach(hb); | ||
| runtime.attach(hb); | ||
|
|
||
|
|
@@ -19,10 +23,10 @@ var create = function() { | |
| var Handlebars = create(); | ||
| Handlebars.create = create; | ||
|
|
||
| module.exports = Handlebars; // instantiate an instance | ||
| export default Handlebars; | ||
|
|
||
| // Publish a Node.js require() handler for .handlebars and .hbs files | ||
| if (require.extensions) { | ||
| if (typeof require !== 'undefined' && require.extensions) { | ||
| var extension = function(module, filename) { | ||
| var fs = require("fs"); | ||
| var templateString = fs.readFileSync(filename, "utf8"); | ||
|
|
@@ -32,10 +36,6 @@ if (require.extensions) { | |
| require.extensions[".hbs"] = extension; | ||
| } | ||
|
|
||
| // BEGIN(BROWSER) | ||
|
|
||
| // END(BROWSER) | ||
|
|
||
| // USAGE: | ||
| // var handlebars = require('handlebars'); | ||
|
|
||
|
|
||
1 comment
on commit 88ee475
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
What is the build/install flow for this for node modules? AFAIK harmony is still buried behind a config flag so node modules will have to use build output as well.