summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--FAQ.md10
-rw-r--r--Gruntfile.js47
-rw-r--r--package.json3
-rw-r--r--spec/amd-runtime.html105
-rw-r--r--spec/amd.html125
5 files changed, 7 insertions, 283 deletions
diff --git a/FAQ.md b/FAQ.md
index 108e839..4946285 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -47,14 +47,6 @@
Should these match, please file an issue with us, per our [issue filing guidelines](https://github.com/wycats/handlebars.js/blob/master/CONTRIBUTING.md#reporting-issues).
-1. Why doesn't IE like the `default` name in the AMD module?
-
- Some browsers such as particular versions of IE treat `default` as a reserved word in JavaScript source files. To safely use this you need to reference this via the `Handlebars['default']` lookup method. This is an unfortunate side effect of the shims necessary to backport the Handlebars ES6 code to all current browsers.
-
1. How do I load the runtime library when using AMD?
- There are two options for loading under AMD environments. The first is to use the `handlebars.runtime.amd.js` file. This may require a [path mapping](https://github.com/wycats/handlebars.js/blob/master/spec/amd-runtime.html#L31) as well as access via the `default` field.
-
- The other option is to load the `handlebars.runtime.js` UMD build, which might not require path configuration and exposes the library as both the module root and the `default` field for compatibility.
-
- If not using ES6 transpilers or accessing submodules in the build the former option should be sufficient for most use cases.
+ The `handlebars.runtime.js` file includes a UMD build, which exposes the library as both the module root and the `default` field for compatibility.
diff --git a/Gruntfile.js b/Gruntfile.js
index 97cfff0..73c5215 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -44,23 +44,6 @@ module.exports = function(grunt) {
},
babel: {
- options: {
- sourceMaps: 'inline',
- loose: ['es6.modules'],
- auxiliaryCommentBefore: 'istanbul ignore next'
- },
- amd: {
- options: {
- modules: 'amd'
- },
- files: [{
- expand: true,
- cwd: 'lib/',
- src: '**/!(index).js',
- dest: 'dist/amd/'
- }]
- },
-
cjs: {
options: {
modules: 'common'
@@ -102,25 +85,6 @@ module.exports = function(grunt) {
}
},
- requirejs: {
- options: {
- optimize: 'none',
- baseUrl: 'dist/amd/'
- },
- dist: {
- options: {
- name: 'handlebars',
- out: 'dist/handlebars.amd.js'
- }
- },
- runtime: {
- options: {
- name: 'handlebars.runtime',
- out: 'dist/handlebars.runtime.amd.js'
- }
- }
- },
-
uglify: {
options: {
mangle: true,
@@ -160,7 +124,7 @@ module.exports = function(grunt) {
all: {
options: {
build: process.env.TRAVIS_JOB_ID,
- urls: ['http://localhost:9999/spec/?headless=true', 'http://localhost:9999/spec/amd.html?headless=true'],
+ urls: ['http://localhost:9999/spec/?headless=true'],
detailedError: true,
concurrency: 4,
browsers: [
@@ -176,11 +140,12 @@ module.exports = function(grunt) {
sanity: {
options: {
build: process.env.TRAVIS_JOB_ID,
- urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/amd-runtime.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
+ urls: ['http://localhost:9999/spec/umd.html?headless=true', 'http://localhost:9999/spec/umd-runtime.html?headless=true'],
detailedError: true,
concurrency: 2,
browsers: [
- {browserName: 'chrome'}
+ {browserName: 'chrome'},
+ {browserName: 'internet explorer', version: 10, platform: 'Windows 8'}
]
}
}
@@ -205,19 +170,17 @@ module.exports = function(grunt) {
'node',
'globals']);
- this.registerTask('amd', ['babel:amd', 'requirejs']);
this.registerTask('node', ['babel:cjs']);
this.registerTask('globals', ['webpack']);
this.registerTask('tests', ['concat:tests']);
- this.registerTask('release', 'Build final packages', ['eslint', 'amd', 'uglify', 'test:min', 'copy:dist', 'copy:components', 'copy:cdnjs']);
+ this.registerTask('release', 'Build final packages', ['eslint', 'uglify', 'test:min', 'copy:dist', 'copy:components', 'copy:cdnjs']);
// Load tasks from npm
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');
- grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-babel');
diff --git a/package.json b/package.json
index a5b7887..ffd742c 100644
--- a/package.json
+++ b/package.json
@@ -42,7 +42,6 @@
"grunt-contrib-concat": "0.x",
"grunt-contrib-connect": "0.x",
"grunt-contrib-copy": "0.x",
- "grunt-contrib-requirejs": "0.x",
"grunt-contrib-uglify": "0.x",
"grunt-contrib-watch": "0.x",
"grunt-eslint": "^17.1.0",
@@ -68,7 +67,7 @@
"jspm": {
"main": "handlebars",
"directories": {
- "lib": "dist/amd"
+ "lib": "dist/cjs"
},
"buildConfig": {
"minify": true
diff --git a/spec/amd-runtime.html b/spec/amd-runtime.html
deleted file mode 100644
index 7cc64f1..0000000
--- a/spec/amd-runtime.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<html>
- <head>
- <title>Mocha</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <link rel="stylesheet" href="/node_modules/mocha/mocha.css" />
- <style>
- .headless .suite > h1,
- .headless .test.pass {
- display: none;
- }
- </style>
-
- <script>
- // Show only errors in "headless", non-interactive mode.
- if (/headless=true/.test(location.href)) {
- document.documentElement.className = 'headless';
- }
- </script>
- <script src="/node_modules/mocha/mocha.js"></script>
- <script>
- mocha.setup('bdd');
- </script>
-
- <script src="/spec/env/json2.js"></script>
- <script src="/spec/env/require.js"></script>
-
- <script src="/spec/env/common.js"></script>
- <script>
- var requireFailure;
-
- requirejs.config({
- paths: {
- 'handlebars.runtime': '/dist/handlebars.runtime.amd'
- }
- });
- requirejs.onError = function (err) {
- requireFailure = err;
- };
- </script>
- <script>
- onload = function(){
- require(['handlebars.runtime'], function(Handlebars) {
- describe('runtime', function() {
- it('should load', function() {
- equal(!!Handlebars['default'].template, true);
- equal(!!Handlebars['default'].VERSION, true);
- });
- });
-
- mocha.globals(['mochaResults'])
- // The test harness leaks under FF. We should have decent global leak coverage from other tests
- if (!navigator.userAgent.match(/Firefox\/([\d.]+)/)) {
- mocha.checkLeaks();
- }
- var runner = mocha.run();
-
- //Reporting for saucelabs
- var failedTests = [];
- runner.on('end', function(){
- window.mochaResults = runner.stats;
- window.mochaResults.reports = failedTests;
- });
-
- runner.on('fail', logFailure);
-
- // Inject any require initilizer failures into the first test so they are properly
- // reported.
- if (requireFailure) {
- runner.on('hook end', function(hook){
- if (requireFailure) {
- runner.uncaught(requireFailure);
- requireFailure = undefined;
- }
- });
- }
-
- function logFailure(test, err){
-
- var flattenTitles = function(test){
- var titles = [];
- while (test.parent.title){
- titles.push(test.parent.title);
- test = test.parent;
- }
- return titles.reverse();
- };
-
- failedTests.push({
- name: test.title,
- result: false,
- message: err.message,
- stack: err.stack,
- titles: flattenTitles(test)
- });
- }
- });
- };
- </script>
- </head>
- <body>
- <div id="mocha"></div>
- </body>
-</html>
diff --git a/spec/amd.html b/spec/amd.html
deleted file mode 100644
index 1149dc7..0000000
--- a/spec/amd.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!doctype html>
-<html>
- <head>
- <title>Mocha</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
-
- <link rel="stylesheet" href="/node_modules/mocha/mocha.css" />
- <style>
- .headless .suite > h1,
- .headless .test.pass {
- display: none;
- }
- </style>
-
- <script>
- // Show only errors in "headless", non-interactive mode.
- if (/headless=true/.test(location.href)) {
- document.documentElement.className = 'headless';
- }
- </script>
- <script src="/node_modules/mocha/mocha.js"></script>
- <script>
- mocha.setup('bdd');
- </script>
-
- <script src="/spec/env/json2.js"></script>
- <script src="/spec/env/require.js"></script>
-
- <script src="/spec/env/common.js"></script>
- <script>
- var requireFailure;
-
- requirejs.config({
- paths: {
- handlebars: '/dist/handlebars.amd',
- tests: '/tmp/tests'
- }
- });
- requirejs.onError = function (err) {
- requireFailure = err;
- };
-
- var CompilerContext = {
- compile: function(template, options) {
- var templateSpec = handlebarsEnv.precompile(template, options);
- return handlebarsEnv.template(safeEval(templateSpec));
- },
- compileWithPartial: function(template, options) {
- return handlebarsEnv.compile(template, options);
- }
- };
-
- function safeEval(templateSpec) {
- try {
- var ret;
- eval('ret = ' + templateSpec);
- return ret;
- } catch (err) {
- console.error(templateSpec);
- throw err;
- }
- }
- </script>
- <script>
- onload = function(){
-
- require(['handlebars'], function(Handlebars) {
- window.Handlebars = Handlebars['default'];
-
- require(['tests'], function(Handlebars) {
- mocha.globals(['mochaResults'])
- // The test harness leaks under FF. We should have decent global leak coverage from other tests
- if (!navigator.userAgent.match(/Firefox\/([\d.]+)/)) {
- mocha.checkLeaks();
- }
- var runner = mocha.run();
-
- //Reporting for saucelabs
- var failedTests = [];
- runner.on('end', function(){
- window.mochaResults = runner.stats;
- window.mochaResults.reports = failedTests;
- });
-
- runner.on('fail', logFailure);
-
- // Inject any require initilizer failures into the first test so they are properly
- // reported.
- if (requireFailure) {
- runner.on('hook end', function(hook){
- if (requireFailure) {
- runner.uncaught(requireFailure);
- requireFailure = undefined;
- }
- });
- }
-
- function logFailure(test, err){
- function flattenTitles(test){
- var titles = [];
- while (test.parent.title){
- titles.push(test.parent.title);
- test = test.parent;
- }
- return titles.reverse();
- }
-
- failedTests.push({
- name: test.title,
- result: false,
- message: err.message,
- stack: err.stack,
- titles: flattenTitles(test)
- });
- }
- });
- });
- };
- </script>
- </head>
- <body>
- <div id="mocha"></div>
- </body>
-</html>