Bugfix: use addon config options #238 #242
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this PR does
It fixes a bug where the consuming app's options set in
ember-cli-build
were not being read by this addon.The problem:
The ember-cli-build.js configuration options were not being used at all by the addon due to a logic mistake in the JavaScript. For example, the
css
boolean below made no difference, and the addon kept using the default styles. Likewise, naming specificsource
paths had no effect.Here's the problem in
index.js
.options
evaluates totrue
or{}
, when it should evaluate to to an object of the options, like{import: { css: false } }
.getDefault
is a function that tries to traverse the options object, but since options is a boolean, it falls back to the addon defaults.The fix
Do the logical check, and then assign the value of
options
:I added a test for this. It can be run with
node tape-tests/utils/get-default-test.js
.Bug replication & solution example app
Here's how to replicate the bug. Inspect
ember-cli-build.js
of this example app, run it locally, and you'll see that the button styles are Semantic's, when the css should be disabled according to the build options.git clone git@github.com:jenweber/semantic-ui-ember-demo.git cd semantic-ui-ember-demo npm install ember serve
Here's the solution in action. Try out the app while using my fork with the bugfix and you will see the styles are disabled as they should be:
P.S. thanks for your work on this addon!