{"id":423,"date":"2016-02-24T15:48:58","date_gmt":"2016-02-24T15:48:58","guid":{"rendered":"http:\/\/www.corrspt.com\/blog\/?p=423"},"modified":"2016-11-19T16:08:25","modified_gmt":"2016-11-19T16:08:25","slug":"conditionally-import-assets-in-ember-cli-build-ks","status":"publish","type":"post","link":"http:\/\/www.corrspt.com\/blog\/2016\/02\/24\/conditionally-import-assets-in-ember-cli-build-ks\/","title":{"rendered":"Conditionally import assets in ember-cli-build.js"},"content":{"rendered":"<p>Hi Guys,<\/p>\n<p>Just wanted to drop another quick post about how to conditionally import assets in ember-cli-build.js. I needed to do that in order to make <a href=\"http:\/\/ember-cli-page-object.js.org\/\">ember-cli-page-object<\/a> work in development mode.<\/p>\n<p>Apparently there&#8217;s already an <a href=\"https:\/\/github.com\/san650\/ember-cli-page-object\/issues\/126\">issue open on github<\/a> about this situation, but since it&#8217;s a solution for the addon and not the user, I&#8217;m going to add it here (until a PR lands you have to do this). Since the ember-cli-build.js file is a regular javascript file you can simply drop these lines on it.<\/p>\n<blockquote><p>\/\/ ember-cli-build.js<\/p>\n<p>if (!app.isProduction) {<br \/>\napp.import(&#8216;bower_components\/ceibo\/index.js&#8217;);<br \/>\n}<\/p><\/blockquote>\n<p><em>app.isProduction<\/em> is a variable defined in <em>ember-cli\/lib\/broccoli\/ember-app<\/em>, not entirely sure if it&#8217;s public API but it gets the job done.<\/p>\n<p>Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi Guys, Just wanted to drop another quick post about how to conditionally import assets in ember-cli-build.js. I needed to do that in order to make ember-cli-page-object work in development mode. Apparently there&#8217;s already an issue open on github about &hellip; <a href=\"http:\/\/www.corrspt.com\/blog\/2016\/02\/24\/conditionally-import-assets-in-ember-cli-build-ks\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[57,49],"class_list":["post-423","post","type-post","status-publish","format-standard","hentry","category-emberjs","tag-ember","tag-emberjs"],"_links":{"self":[{"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/posts\/423","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/comments?post=423"}],"version-history":[{"count":2,"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/posts\/423\/revisions"}],"predecessor-version":[{"id":443,"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/posts\/423\/revisions\/443"}],"wp:attachment":[{"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/media?parent=423"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/categories?post=423"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.corrspt.com\/blog\/wp-json\/wp\/v2\/tags?post=423"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}