diff --git a/.editorconfig b/.editorconfig index 5d5dea4..2fe4874 100644 --- a/.editorconfig +++ b/.editorconfig @@ -29,5 +29,5 @@ indent_size = 2 indent_style = space indent_size = 2 -[*.md] +[*.{diff,md}] trim_trailing_whitespace = false diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..caf7efe --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "docs"] + path = docs + url = git@github.com:sir-dunxalot/ember-cli-concat.wiki.git diff --git a/.travis.yml b/.travis.yml index cf23938..2377a5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ language: node_js sudo: false +git: + submodules: false + cache: directories: - node_modules diff --git a/Brocfile.js b/Brocfile.js index 49803f0..7e90df8 100644 --- a/Brocfile.js +++ b/Brocfile.js @@ -4,12 +4,12 @@ var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); var app = new EmberAddon({ + storeConfigInMeta: false, fingerprint: { enabled: true, }, emberCliConcat: { - enabled: false - /* Add custom options here */ + /* Test custom options here */ } }); diff --git a/README.md b/README.md index a458afc..4e5ed7e 100644 --- a/README.md +++ b/README.md @@ -1,253 +1,79 @@ -# Ember-cli-concat +Ember-cli-concat [![Build Status](https://travis-ci.org/sir-dunxalot/ember-cli-concat.svg?branch=develop)](https://travis-ci.org/sir-dunxalot/ember-cli-concat) [![Ember Addon](https://s3.amazonaws.com/images.jebbit.com/ember/badge.svg)](//emberaddons.com) +====== -`ember-cli-concat` is an Ember CLI addon that: -- Concatenates your javascript files into a single js file for production -- Concatenates your stylesheets into a single css file for production -- Automatically adds the relevant ` - - - +```shell +cd docs +git submodule update --init --recursive # Updates submodule ``` -## Issues +You can open a PR to the documentation, as usual. Please note it is technically a seperate git repo. -Please open an issue or PR. ## Inspirational Quotation diff --git a/bower.json b/bower.json index 2f7f558..6825afd 100644 --- a/bower.json +++ b/bower.json @@ -4,8 +4,8 @@ "handlebars": "~1.3.0", "jquery": "^1.11.1", "ember": "1.8.1", - "ember-data": "1.0.0-beta.11", - "ember-resolver": "~0.1.10", + "ember-data": "1.0.0-beta.12", + "ember-resolver": "~0.1.11", "loader.js": "stefanpenner/loader.js#1.0.1", "ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3", "ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4", diff --git a/docs b/docs new file mode 160000 index 0000000..6739b50 --- /dev/null +++ b/docs @@ -0,0 +1 @@ +Subproject commit 6739b503724d5f1b8ce488325563b7788f9d9a4b diff --git a/index.js b/index.js index a715e13..ca3a0b0 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,7 @@ /* Dependencies */ -var concat = require('broccoli-concat'); +var concat = require('broccoli-sourcemap-concat'); var fileRemover = require('broccoli-file-remover'); var mergeTrees = require('broccoli-merge-trees'); @@ -146,6 +146,37 @@ module.exports = { outputFileName: 'app', + /** + The name of the Ember CLI content-for hook to use to add scripts to your app. The content-for hooks are generally found in index.html files. + + @property scriptsContentFor + @type String + @default 'body' + */ + + scriptsContentFor: 'body', + + /** + The name of the Ember CLI content-for hook to use to add styles to your app. The content-for hooks are generally found in index.html files. + + If you're using an Ember CLI version **below** 1.4.0 you should set this value to `head`: + + ```js + // Ember CLI less than v1.4.0 + var app = new EmberApp({ + emberCliConcat: { + stylesContentFor: 'head' + } + }); + ``` + + @property stylesContentFor + @type String + @default 'head-footer' + */ + + stylesContentFor: 'head-footer', + /** Whether or not to use self closing HTML tags for the ` + + {{content-for 'head-footer'}} + {{content-for 'test-head-footer'}} {{content-for 'body'}} {{content-for 'test-body'}} - + + + {{content-for 'body-footer'}} + {{content-for 'test-body-footer'}} diff --git a/tests/unit/.gitkeep b/tests/integration/.gitkeep similarity index 100% rename from tests/unit/.gitkeep rename to tests/integration/.gitkeep diff --git a/tests/integration/addon-test.js b/tests/integration/addon-test.js new file mode 100644 index 0000000..f2a6ab4 --- /dev/null +++ b/tests/integration/addon-test.js @@ -0,0 +1,57 @@ +import Em from 'ember'; +import { test } from 'ember-qunit'; +import startApp from '../helpers/start-app'; +import config from 'dummy/config/environment'; + +var App; + +module('Ember CLI Concat', { + + setup: function() { + App = startApp(); + }, + + teardown: function() { + Em.run(App, 'reset'); + } + +}); + +var checkTagExists = function(fileName) { + var isCSS = fileName.indexOf('.css') > -1; + var attribute = isCSS ? 'href' : 'src'; + var element = isCSS ? 'link' : 'script'; + var tagExists = $(element + '[' + attribute + '="/assets/' + fileName + '"]').length === 1; + + ok(tagExists, fileName + ' ' + element + ' tag should be written to to the index.html file'); +}; + +test('Assets added to index.html file', function() { + + andThen(function() { + var env = config.environment; + var appFiles, vendorFiles, testFiles; + + if (env === 'development') { + checkTagExists('dummy.css'); + checkTagExists('vendor.css'); + checkTagExists('dummy.js'); + checkTagExists('vendor.js'); + + if (App.testing) { + checkTagExists('test-support.css'); + checkTagExists('test-support.js'); + } + } else if (env === 'production') { + + /* TODO - Currently can't run tests in production environment */ + + checkTagExists('app.css'); + checkTagExists('app.js'); + } else { + expect(0); + } + + }); + +});