-
Notifications
You must be signed in to change notification settings - Fork 74
Handle CSS dependencies from JS comments #178
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
Comments
Did you get started on this? PS: I've added a link to the Mobile implementation in the ticket description |
No, I haven't started. Thank you for the link. |
First step is to define "Mobile's approach of specifying CSS dependencies in comments in JS files". It's currently not documented. But, it's not hard to deduce by looking at mobile's source files that it's of the form: @gseguin (cc @uGoMobi) could you confirm please? If the above is correct, |
That looks wrong. "css.button" doesn't match anything currently used in mobile, where you've got "css.structure" and "css.theme". We can use the same pattern in UI, since we also separate structure and theme, and not all components need the theme (like the interactions). |
Also the paths are relative from their |
Ah! I've overlooked that. You are correct. So, it looks like mobile uses "structure" and "theme" as bundle names when building the package.
You are correct. Although, I think it should be considered a change to either: (a) relative to the current file, or (b) absolute to the project's root. Being relative to the js path seems hard to generalize. |
This seems to me like the better approach, since you won't have to adjust this path when moving files around. Assuming jQuery Mobile and UI have CSS files in the same folder, they could also keep the path when importing widgets like tabs, instead of having to adjust that to the local file structure. |
The plan is for mobile to change file structure to match so this sounds good to me |
Shouldn't it be relative to the AMD |
Why? |
To be consistent with the AMD modules. I don't have a strong opinion about it, that just seems like another viable alternative. |
I'm confused. Because on Anyway, I am just spotting a place that could be improved in my opinion. But, I also don't have a strong opinion about it. |
@gseguin, @jzaefferer can we import @gseguin's |
Feel free to use and/or rewrite any part of that code. |
Cool! 😀 Thanks. I guess we're good in terms of licensing, right? |
Per today's meeting, we are not going to change the way mobile is currently handling CSS'es. @gseguin is going to check if it's possible to expose his buildCssBundle() function, so DownloadBuilder can make function calls to obtain the built CSSes. |
I've been able to use @gseguin's css builder just fine. I am just concerned it makes us think this will drive us towards generalizing Download Builder in a way we can control the styles of the package in an arbitrary way by changing the style directives in the code comments. It's not going to happen unless we change things... First of all, there's nothing wrong with @gseguin's code. It does what it has to do perfectly (build both UI style bundles: structure and theme in an excellent generic way). The issue is the extra steps we have in the UI package #207. |
Package has been simplified. Not an issue anymore. |
So are you able to move ahead with this now? |
Yes, there are no blockers to use @gseguin's code in order to address this issue. (that I am aware of) |
This has gone stale, and i'm fairly sure the plan has changed, and there are blockers here. To update on several related discussions, that seem to have no documentation, which happened since this issue was last updated... There is a problem that came up just using @gseguin 's module as is. The css dependencies in the comments will map to non existent files, when the widgets are pulled from ui into mobile. To fix this we need something similar to an AMD paths config. I believe this was discussed between @rxaviers and @gseguin in Chicago, and they decided to use amd for the css, under the hood. To avoid the issues previously discussed around that and forcing devs to use css dep management in their amd, the comments will stay, but they will be parsed into AMD. Related but perhaps separate is the need to separate css dependency from JS dependency. This comes up in 2 forms with the new button re-write. 1.) Some components now depend on button CSS, but not the JS, like selectmenu. Selecting selectmenu in the builder should pull in button CSS but not the JS. 2.) Because we now support "CSS Only" buttons and controlgroups, there should be a way in builder, to select button css, with out including the JS widget. ref #246 |
Hi @arschmitz, yes your overall understanding is correct. We decided not to reinvent the wheel. Under the hoods, we'll transform the CSS comments into AMD definitions and let r.js handle that (via one of its css plugins) to generate the bundles (JS and CSS).
Have selectmenu to define its dependency on the button css (e.g.,
Any suggestion on how this should look like? |
As long as this will support multiple comma seperated or whatever files thats fine because it would need to be like As far as how the ui would work i'm thinking the css would be its own module maybe? and the main button module would depend on the button-css module? @scottgonzalez I know we talked about this at one point and you agreed in concept that this should be possible. Don't remember if you had a suggestion on exactly how it would work though? |
Yes, having multiple CSSes is possible. |
I'd suggest an overhaul of the whole page layout. We can add a CSS Components section and rename Components to JS Components. Instead of three columns, we should have the headers full width with their descriptions. The component names and descriptions don't need so much visual spacing, they can just be thrown together with the name being bold and followed by a colon. The Theme section can probably just become part of the CSS Components section. We can probably put JS Components and CSS Components side by side in two columns to prevent the page from becoming super long. I'm not sure what we'd do about older versions though. |
@arschmitz you said on IRC that this needs to land in 1.12. Based on the discussion here since that comment, I'm concerned that this will delay the 1.12 release, potentially quite a lot. Can you explain how this a blocker for Mobile? Are there workarounds? |
@jzaefferer well part of this is required. The new ui and ability to download seperate css / js for components is NOT required. What is required is the ability to set paths for the css with a r.js config and for mobile to be able to actually use the UI download builder. These from what I understand are not far off ( unlike the new ui ). |
Okay, so let's split this into two tasks. One takes care of the underlying infrastructure, the other overhauls the user interface for custom downloads. I'd appreciate if someone else could create that second ticket, since I'm still not completely clear about the exact split. |
On it! |
Created #250 |
- Handle CSS dependencies from JS comments (based on jQuery Mobile); - Use archive-packager, builder-amd and builder-jquery-css to build UI 1.12.0 download package; Fixes #178 Fixes #255 Ref jquery/jquery-ui#1440
- Handle CSS dependencies from JS comments (based on jQuery Mobile); - Use archive-packager, builder-amd and builder-jquery-css to build UI 1.12.0 download package; Fixes #178 Fixes #255 Ref jquery/jquery-ui#1440
- Handle CSS dependencies from JS comments (based on jQuery Mobile); - Use archive-packager, builder-amd and builder-jquery-css to build UI 1.12.0 download package; Fixes #178 Fixes #255 Ref jquery/jquery-ui#1440
As Jörn stated on jquery/jquery-ui#1029 (comment), handle CSS dependencies as discussed.
The jQuery Mobile download builder already implements this.
The text was updated successfully, but these errors were encountered: