-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow custom semantic-ui builds #141
Allow custom semantic-ui builds #141
Conversation
Thanks, I should get a chance to look into these in the next couple of days. |
This is awesome , really needed. This will reduce a lot of pain in choosing themse. Please merge |
The hesitation was mostly around not having unit tests to verify changes for this and for the future. I had an idea tonight, if we could pull the app import methods into a utilities class, then we could import that class to do the calls and test the results. @khornberg would you be open to added that to this pull request? If so I can detail out more what I'm thinking |
@aaronbhansen Sure, I would like to add tests if you have something in mind |
@aaronbhansen I'm not sure what you were thinking; I am not sure how one can test if the proper file is included in a build of ember. I have thought about how to test the the function that gives us the paths to import.
|
seems all good ? |
@khornberg sorry for the delay in responding, this weeks been crazy busy. A quick overview of my idea was to move the url generation into a utils file and then test that. I should get time this weekend to explain a little more and provide an update. |
Ok, no worries. I'll push what I've worked on today. A few hours ago I realized that the |
@v3ss0n It is ready to test now |
CI is failing because Semantic-UI-Ember/addon/mixins/base.js Line 38 in 99086c2
|
} | ||
buildPaths(options).forEach(function(path) { | ||
if (Array.isArray(path)) { | ||
app.import(path[0], path[1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never used import like that before. I thought it was always a string or an object. I couldn't see if in the documentation either. Can you point me to where this is supported instead of an object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I see what you're doing below. I missed that before.
Sorry for the delay in responding, I think its fine to leave most the code in index.js, I think that separates out concerns better. Mostly what I wanted to test was to pull out the default code and some simple formatting code into a separate util, test that, and then import that util into the index.js to produce the final result. As an example index.js could look like
The generation util has three new methods we can test. Those are default (method):Parameters The first argument default finds that exists on the objects passed in is returned. The object could be null or empty string. We just need to check if the key exists on the object. Now that we have multiple settings, it would be nice to nest them in the object. Have the app settings look like
but we also need to support a flat version for older projects.
In essence what the default method does is try to first resolve any variables that exist on the full path first, then the fall back, then the default full path, then the default fallback. The check would be something like
The next method would be import (method):Parameters Same functionality and idea as default, but its specifically looking for a true / false value instead of first argument found on the object. Last method would be format (method):Parameters The reason we allow null or empty strings on default is for here. Lets say that they don't want to put the theme assets under theme. They could do this.
The generation would look like var destination = generate.format('assets/themes', theme, 'assets/images'); the format method checks each value in the array and if the value is null, undefined, or whitespace, it removes it from the array. Then we just do a simple [remaining values].join('/') to return the value. Wrapping upIn the end, if we can create those three methods, and have tests against them, that will allow us to have much more flexibility in the future and start to allow multiple configuration options for anyones needs. Let me know what you think |
Do you have a strong preference of The tests seem fairly straight forward so I think either one would work fine. |
I don't necessarily love qunit, but its the default ember path, and its the path of less resistance. I'd rather just use qunit than have two testing frameworks installed. Here is a helper with the default qunit test for non ember utils.
|
@aaronbhansen Yep don't disagree. As far as I understand, |
Thats correct, looks like the path can be anywhere from the other examples I've seen. https://github.com/emberjs/data/blob/master/index.js#L110 |
@aaronbhansen How would the imports work with Maybe I'm missing something but those are not working for me. |
@aaronbhansen I don't think the I've updated the In manual tests of |
Yeah after looking at it, they aren't needed. Initially I was thinking of it differently, but since all the imports are bools, it doesn't matter. Lets switch over to qunit and I think thats enough to merge in. Then we can update your other pull request on documentation with the new recommend structure. |
@aaronbhansen I can certainly try to add Since we have to add something anyways to the add for these tests what do you think we should do? Do you happen to know how to add qunit tests in node? Is there anything I need to add so that tests are run on CI? |
I don't think it needs to be installed separately. We test utils just like we are doing in this repo with just ember-qunit installed. I believe that package adds qunit as a dependency. Here is a screenshot of our actual utils tested in a shared repo. https://cl.ly/0m0a0M1s1T2d |
What does As I understand it, |
It can't import like that, but you can do require('addon/utils/generator') in index.js. And as long as it doesn't have any es6 code, it should import just fine. Then on the flip side you could import or require it yet again in the tests to test the code. The computed sum by does have import statements, thats only because its only used within es6 code, but how generator is today it should be fine. |
With that said, if you're stuck, I can merge in and then finish making the changes later this weekend or monday. |
3729da4
to
ea6a94d
Compare
After trying a few things, I'm still not getting things to import. I've rebased to master and a single commit. From what I understand everything should be fairly easy to make testable with qunit. I've stuck everything in |
@aaronbhansen I've checked the |
1b9da4e
to
89e867b
Compare
5e775f8
to
b532650
Compare
Adds two configuration options. One for the path to the `dist` folder of Semantic. The other option to specify the theme used for images and fonts. Note that this does not add support for importing files outside of the build tree (e.g. `bower_components`). One can use `bower link` for local projects.
This allows one to change the icons used in a Semantic UI build without modifying the location within Semantic UI. For example, if one builds Semantic UI with the material theme for icons, this allows one to set the expected directory of those icons in ember.
b532650
to
8f8ab39
Compare
@aaronbhansen This is passing again and rebased to master. I tried again to |
Thank @khornberg I finally got time to start working on this again last night. Last week got a bit too busy. I'm going to update ember and dependencies, then look at getting this merged in and released this week. |
Cool, totally understand |
Ok can't wait to test. |
Thanks, going to pull this in an finish the changes on master 👍 |
Awesome , gonna test tomorrow. |
@khornberg take a look at this commit 9cc8eed. Also, I couldn't get it to work on es6 imports either. It was creating a loop when I did. I figured tape was the easiest and set it up like i've seen on other projects with node-tests |
@aaronbhansen Thanks, those changes add clarity; everything seems to work fine with the customization. |
Glad to hear it worked. Thanks for all the work you did on it. |
Adds two configuration options. One for the path to the
dist
folder ofSemantic. The other option to specify the theme used for images and
fonts.
Note that this does not add support for importing files outside of the
build tree (e.g.
bower_components
). One can usebower link
for localprojects.