├── .bowerrc ├── .editorconfig ├── .ember-cli ├── .gitignore ├── .jshintrc ├── .npmignore ├── .travis.yml ├── Brocfile.js ├── LICENSE.md ├── README.md ├── addon └── .gitkeep ├── app ├── .gitkeep └── initializers │ └── css-module-route.js ├── bower.json ├── config └── environment.js ├── index.js ├── package.json ├── testem.json ├── tests ├── .jshintrc ├── dummy │ ├── app │ │ ├── app.js │ │ ├── components │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ └── .gitkeep │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── index.html │ │ ├── models │ │ │ └── .gitkeep │ │ ├── router.js │ │ ├── routes │ │ │ ├── .gitkeep │ │ │ ├── planet.js │ │ │ └── planet │ │ │ │ ├── earth.js │ │ │ │ └── mars.js │ │ ├── styles │ │ │ ├── app.css │ │ │ └── planet │ │ │ │ ├── .DS_Store │ │ │ │ ├── earth │ │ │ │ ├── no-build.css │ │ │ │ └── styles.css │ │ │ │ └── styles.css │ │ ├── templates │ │ │ ├── application.hbs │ │ │ ├── components │ │ │ │ └── .gitkeep │ │ │ ├── planet.hbs │ │ │ └── planet │ │ │ │ ├── earth.hbs │ │ │ │ └── mars.hbs │ │ └── views │ │ │ └── .gitkeep │ ├── config │ │ └── environment.js │ └── public │ │ ├── crossdomain.xml │ │ └── robots.txt ├── helpers │ ├── resolver.js │ └── start-app.js ├── index.html ├── test-helper.js └── unit │ ├── .gitkeep │ └── initializers │ └── css-module-route-test.js └── vendor └── .gitkeep /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.js] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.hbs] 21 | indent_style = space 22 | indent_size = 2 23 | 24 | [*.css] 25 | indent_style = space 26 | indent_size = 2 27 | 28 | [*.html] 29 | indent_style = space 30 | indent_size = 2 31 | 32 | [*.{diff,md}] 33 | trim_trailing_whitespace = false 34 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "-Promise" 6 | ], 7 | "browser": true, 8 | "boss": true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | bower_components/ 2 | tests/ 3 | tmp/ 4 | 5 | .bowerrc 6 | .editorconfig 7 | .ember-cli 8 | .travis.yml 9 | .npmignore 10 | **/.gitkeep 11 | bower.json 12 | Brocfile.js 13 | testem.json 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | 4 | sudo: false 5 | 6 | cache: 7 | directories: 8 | - node_modules 9 | 10 | before_install: 11 | - "npm config set spin false" 12 | - "npm install -g npm@^2" 13 | 14 | install: 15 | - npm install -g bower 16 | - npm install 17 | - bower install 18 | 19 | script: 20 | - npm test 21 | -------------------------------------------------------------------------------- /Brocfile.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | /* global require, module */ 3 | 4 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 5 | 6 | var app = new EmberAddon(); 7 | 8 | // Use `app.import` to add additional libraries to the generated 9 | // output files. 10 | // 11 | // If you need to use different assets in different 12 | // environments, specify an object as the first parameter. That 13 | // object's keys should be the environment name and the values 14 | // should be the asset to use in that environment. 15 | // 16 | // If the library that you are including contains AMD or ES6 17 | // modules that you would like to import into your application 18 | // please specify an object with the list of modules as keys 19 | // along with the exports of each module as its value. 20 | 21 | module.exports = app.toTree(); 22 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ember CSS Routes 2 | 3 | This is an Ember add-on to allow CSS files to be broken up and served based on routes, rather than forcing a single CSS file for the entire application on initial load. 4 | 5 | ## Usage 6 | 7 | The add-on looks for and compiles all files named `styles` within your `app/styles` folder. These are mapped to route based on the folder structure. 8 | 9 | Ex: `app/styles/planet/earth/styles.scss` will be output as `assets/profile/view/styles.css` and loaded on the `profile/view` route. 10 | 11 | _Note: current version has been verified to work with `broccoli-sass` and normal CSS_ 12 | 13 | ### Route Opt-out 14 | 15 | The implementation attempts to load a stylesheet for _all_ routes. In order to opt-out of loading a stylesheet, simply add the property `noCSS: true` to that route. Example: 16 | 17 | ```javascript 18 | export default Ember.Route.extend({ 19 | noCSS: true 20 | }); 21 | ``` 22 | 23 | ### Using The `beforeModel` Hook 24 | 25 | With the current implementation, if you need to use the `beforeModel` hook on your route, you'll need to call `this._super()` from inside and return the promise generated by it. Otherwise, the CSS won't load. 26 | 27 | Looking for a way to resolve this dependency currently. 28 | -------------------------------------------------------------------------------- /addon/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/addon/.gitkeep -------------------------------------------------------------------------------- /app/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/app/.gitkeep -------------------------------------------------------------------------------- /app/initializers/css-module-route.js: -------------------------------------------------------------------------------- 1 | /** 2 | * This initializer adds a 'beforeModel' method to every route that makes it 3 | * check for CSS related to the route. 4 | */ 5 | import Ember from 'ember'; 6 | 7 | let alreadyRun = false; 8 | 9 | /** 10 | * Generates the path to a stylesheet for a route based on the route's name 11 | * @param {String} route - A route name in the form given by 'routeName' 12 | * @return {String} 13 | */ 14 | function createStylesheetPath(route) { 15 | let path = route.split('.').join('/'); 16 | return '/assets/' + path + '/styles.css'; 17 | } 18 | 19 | /** 20 | * Creates a link element for the stylesheet for a given route 21 | * @param {String} route - A route name in the form given by 'routeName' 22 | * @return {HTMLLinkElement} link 23 | */ 24 | function createStylesheetLink(route) { 25 | let link = document.createElement('link'); 26 | link.rel = 'stylesheet'; 27 | link.href = createStylesheetPath(route); 28 | return link; 29 | } 30 | 31 | /** 32 | * Determines if a route is an 'index' or 'application' route 33 | * @param {String} route - A route name in the form given by 'routeName' 34 | * @return {Boolean} 35 | */ 36 | function isIndexRoute(route) { 37 | return route.indexOf('index') !== -1 || route.indexOf('application') !== -1; 38 | } 39 | 40 | export function initialize() { 41 | // Don't run initializer more than once 42 | if (alreadyRun) { return; } 43 | 44 | alreadyRun = true; 45 | 46 | Ember.Route.reopen({ 47 | /** 48 | * Checks if the CSS for the route has been loaded, if not it inserts a new 49 | * link element to load the stylesheet and returns a promise that resolves 50 | * when it has finished loading. 51 | * @return {Promise} promise 52 | */ 53 | beforeModel: function() { 54 | /** 55 | * There are 3 cases where we don't load a CSS file: 56 | * 1. The route has specified there is no CSS file via 'noCSS' 57 | * 2. The CSS file has already been loaded 58 | * 3. The route is 'application' or an 'index' route (this is because 59 | * 'route.index' should have the same CSS file as 'route') 60 | */ 61 | if (this.noCSS || this._cssLoaded || isIndexRoute(this.routeName)) { 62 | return; 63 | } 64 | 65 | // Create the link element for the route's CSS file 66 | let link = createStylesheetLink(this.routeName); 67 | 68 | // Create a promise to let us know when the stylesheet is loaded 69 | let promise = new Promise((resolve, reject) => { 70 | // Check that the link has 'onload' and 'onerror' handlers 71 | if (link.hasOwnProperty('onload') && link.hasOwnProperty('onerror')) { 72 | link.onload = () => { 73 | this._cssLoaded = true; 74 | resolve(); 75 | } 76 | 77 | // Even when an error is thrown, we don't fail out completely 78 | link.onerror = () => { 79 | resolve(); 80 | } 81 | } else { 82 | // Use the old img.onerror hack to detect when stylesheet is loaded 83 | let img = document.createElement('img'); 84 | img.onerror = function() { 85 | this._cssLoaded = true; 86 | resolve(); 87 | } 88 | img.src = createStylesheetPath(this.routeName); 89 | } 90 | }); 91 | 92 | document.head.appendChild(link); 93 | 94 | return promise; 95 | } 96 | }); 97 | }; 98 | 99 | export default { 100 | name: 'css-module-route', 101 | initialize: initialize 102 | }; 103 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-css-routes", 3 | "dependencies": { 4 | "jquery": "^1.11.1", 5 | "ember": "1.10.0", 6 | "ember-data": "1.0.0-beta.15", 7 | "ember-resolver": "~0.1.12", 8 | "loader.js": "ember-cli/loader.js#3.2.0", 9 | "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", 10 | "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", 11 | "ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2", 12 | "ember-qunit": "0.2.8", 13 | "ember-qunit-notifications": "0.0.7", 14 | "qunit": "~1.17.1" 15 | } 16 | } -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(/* environment, appConfig */) { 4 | return { }; 5 | }; 6 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var fs = require('fs'); 5 | var path = require('path'); 6 | 7 | /** 8 | * Recursive method to walk a directory and return a list of all it's files 9 | * with their paths relative to either a given directory or the directory 10 | * being walked 11 | * @param {String} dir - A string representing the directory to walk 12 | * @param {String} relDir - A directory to make the results relative to 13 | * @return {Array} results 14 | */ 15 | function walkDir(dir, relDir) { 16 | var fileList = fs.readdirSync(dir); 17 | var results = []; 18 | var stat, file; 19 | 20 | relDir = relDir || dir; 21 | 22 | for (var i=0, l=fileList.length; i= 0.10.0" 20 | }, 21 | "author": "Trent Willis ", 22 | "license": "MIT", 23 | "devDependencies": { 24 | "broccoli-asset-rev": "^2.0.0", 25 | "ember-cli": "^0.2.1", 26 | "ember-cli-app-version": "0.3.2", 27 | "ember-cli-babel": "^4.0.0", 28 | "ember-cli-content-security-policy": "0.3.0", 29 | "ember-cli-dependency-checker": "0.0.8", 30 | "ember-cli-htmlbars": "0.7.4", 31 | "ember-cli-ic-ajax": "0.1.1", 32 | "ember-cli-inject-live-reload": "^1.3.0", 33 | "ember-cli-qunit": "0.3.9", 34 | "ember-cli-uglify": "1.0.1", 35 | "ember-data": "1.0.0-beta.15", 36 | "ember-export-application-global": "^1.0.2" 37 | }, 38 | "keywords": [ 39 | "ember-addon", 40 | "routes", 41 | "css", 42 | "sass" 43 | ], 44 | "ember-addon": { 45 | "configPath": "tests/dummy/config" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /testem.json: -------------------------------------------------------------------------------- 1 | { 2 | "framework": "qunit", 3 | "test_page": "tests/index.html?hidepassed", 4 | "launch_in_ci": [ 5 | "PhantomJS" 6 | ], 7 | "launch_in_dev": [ 8 | "PhantomJS", 9 | "Chrome" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "define", 10 | "console", 11 | "visit", 12 | "exists", 13 | "fillIn", 14 | "click", 15 | "keyEvent", 16 | "triggerEvent", 17 | "find", 18 | "findWithAssert", 19 | "wait", 20 | "DS", 21 | "andThen", 22 | "currentURL", 23 | "currentPath", 24 | "currentRouteName" 25 | ], 26 | "node": false, 27 | "browser": false, 28 | "boss": true, 29 | "curly": false, 30 | "debug": false, 31 | "devel": false, 32 | "eqeqeq": true, 33 | "evil": true, 34 | "forin": false, 35 | "immed": false, 36 | "laxbreak": false, 37 | "newcap": true, 38 | "noarg": true, 39 | "noempty": false, 40 | "nonew": false, 41 | "nomen": false, 42 | "onevar": false, 43 | "plusplus": false, 44 | "regexp": false, 45 | "undef": true, 46 | "sub": true, 47 | "strict": false, 48 | "white": false, 49 | "eqnull": true, 50 | "esnext": true 51 | } 52 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from 'ember/resolver'; 3 | import loadInitializers from 'ember/load-initializers'; 4 | import config from './config/environment'; 5 | 6 | Ember.MODEL_FACTORY_INJECTIONS = true; 7 | 8 | var App = Ember.Application.extend({ 9 | modulePrefix: config.modulePrefix, 10 | podModulePrefix: config.podModulePrefix, 11 | Resolver: Resolver 12 | }); 13 | 14 | loadInitializers(App, config.modulePrefix); 15 | 16 | export default App; 17 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/controllers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/helpers/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy 7 | 8 | 9 | 10 | {{content-for 'head'}} 11 | 12 | 13 | 14 | 15 | {{content-for 'head-footer'}} 16 | 17 | 18 | {{content-for 'body'}} 19 | 20 | 21 | 22 | 23 | {{content-for 'body-footer'}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/models/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import config from './config/environment'; 3 | 4 | var Router = Ember.Router.extend({ 5 | location: config.locationType 6 | }); 7 | 8 | Router.map(function() { 9 | this.route('planet', function() { 10 | this.route('earth'); 11 | this.route('mars'); 12 | }); 13 | }); 14 | 15 | export default Router; 16 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/routes/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/routes/planet.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Route.extend({}); 4 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/planet/earth.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Route.extend({}); 4 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/planet/mars.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Route.extend({}); 4 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | color: #f00; 3 | } 4 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/planet/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/styles/planet/.DS_Store -------------------------------------------------------------------------------- /tests/dummy/app/styles/planet/earth/no-build.css: -------------------------------------------------------------------------------- 1 | h4 { 2 | color: red; 3 | } 4 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/planet/earth/styles.css: -------------------------------------------------------------------------------- 1 | h3 { 2 | color: #00f; 3 | } 4 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/planet/styles.css: -------------------------------------------------------------------------------- 1 | h2 { 2 | color: #0f0; 3 | } -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |

Ember

2 | 3 | {{link-to "Go to Planets" "planet"}} 4 | 5 | {{outlet}} 6 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/templates/components/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/app/templates/planet.hbs: -------------------------------------------------------------------------------- 1 | {{link-to "Go to Index" "application"}} 2 | 3 |

Planet

4 | 5 | {{link-to "Go to Earth" "planet.earth"}} 6 | {{link-to "Go to Mars" "planet.mars"}} 7 | 8 | {{outlet}} 9 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/planet/earth.hbs: -------------------------------------------------------------------------------- 1 | {{link-to "Go to Planets" "planet"}} 2 | 3 |

Earth

4 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/planet/mars.hbs: -------------------------------------------------------------------------------- 1 | {{link-to "Go to Planets" "planet"}} 2 | 3 |

Mars

4 | -------------------------------------------------------------------------------- /tests/dummy/app/views/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/dummy/app/views/.gitkeep -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 3 | module.exports = function(environment) { 4 | var ENV = { 5 | modulePrefix: 'dummy', 6 | environment: environment, 7 | baseURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. 'with-controller': true 13 | } 14 | }, 15 | 16 | APP: { 17 | // Here you can pass flags/options to your application instance 18 | // when it is created 19 | } 20 | }; 21 | 22 | if (environment === 'development') { 23 | // ENV.APP.LOG_RESOLVER = true; 24 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 25 | // ENV.APP.LOG_TRANSITIONS = true; 26 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 27 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 28 | } 29 | 30 | if (environment === 'test') { 31 | // Testem prefers this... 32 | ENV.baseURL = '/'; 33 | ENV.locationType = 'none'; 34 | 35 | // keep test console output quieter 36 | ENV.APP.LOG_ACTIVE_GENERATION = false; 37 | ENV.APP.LOG_VIEW_LOOKUPS = false; 38 | 39 | ENV.APP.rootElement = '#ember-testing'; 40 | } 41 | 42 | if (environment === 'production') { 43 | 44 | } 45 | 46 | return ENV; 47 | }; 48 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember/resolver'; 2 | import config from '../../config/environment'; 3 | 4 | var resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Application from '../../app'; 3 | import Router from '../../router'; 4 | import config from '../../config/environment'; 5 | 6 | export default function startApp(attrs) { 7 | var application; 8 | 9 | var attributes = Ember.merge({}, config.APP); 10 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 11 | 12 | Ember.run(function() { 13 | application = Application.create(attributes); 14 | application.setupForTesting(); 15 | application.injectTestHelpers(); 16 | }); 17 | 18 | return application; 19 | } 20 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for 'head'}} 11 | {{content-for 'test-head'}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for 'head-footer'}} 18 | {{content-for 'test-head-footer'}} 19 | 20 | 21 | 22 | {{content-for 'body'}} 23 | {{content-for 'test-body'}} 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for 'body-footer'}} 31 | {{content-for 'test-body-footer'}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | 6 | setResolver(resolver); 7 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/tests/unit/.gitkeep -------------------------------------------------------------------------------- /tests/unit/initializers/css-module-route-test.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import { initialize } from '../../../initializers/css-module-route'; 3 | import { module, test } from 'qunit'; 4 | 5 | var container, application; 6 | 7 | module('CssModuleRouteInitializer', { 8 | beforeEach: function() { 9 | Ember.run(function() { 10 | application = Ember.Application.create(); 11 | container = application.__container__; 12 | application.deferReadiness(); 13 | }); 14 | } 15 | }); 16 | 17 | // Replace this with your real tests. 18 | test('it works', function(assert) { 19 | initialize(container, application); 20 | 21 | // you would normally confirm the results of the initializer here 22 | assert.ok(true); 23 | }); 24 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trentmwillis/ember-css-routes/80ae89645f6629d5f6d32f36667c8431db6e8937/vendor/.gitkeep --------------------------------------------------------------------------------