Skip to content
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

css module hangs when file doesn't exist #25

Open
jfgilliam opened this issue Feb 13, 2014 · 2 comments
Open

css module hangs when file doesn't exist #25

jfgilliam opened this issue Feb 13, 2014 · 2 comments

Comments

@jfgilliam
Copy link

I want to load a css module only if it exists. This is to allow end users to create an overrides.css if they want to override what I deliver. I think this is better than them modifying my css or modifying the markup to include theirs, because an update will wipe out their changes. Is there a way to conditionally load the file?

@kriszyp
Copy link
Owner

kriszyp commented Feb 13, 2014

Do you have a way of determining (through some configuration) if the css module should be loaded prior to attempting to load it? Or do you want to just always try to load and see if there is a 404? Do you need notification for when the CSS was loaded? If you just need to request a stylesheet, you can do so like this: https://github.com/kriszyp/xstyle/blob/master/core/load-css.js#L103
If you need to be notified, you can use that plugin module. You could also conditionally call the load method based on some configuration information, if you have that available to you.

@jfgilliam
Copy link
Author

I don't care if it is loaded, but if it is loaded, I want it to wait until it is parsed. Thanks for the link to the code, I was looking for that before I created the issue. I see you have a !nowait option. Looks like that option is working for me. I'm doing this.

                        "xstyle/css!./useroverrides.css!nowait",
                        "dojo/domReady!"

So, maybe I'm good. But an option that would act like nowait and continue on after it times out, might be the only way to be sure. How does "!optional" sound? Right now, if I don't use the !nowait, I see the 404 and the timeout in the console but my code never gets called.


Jeff


From: Kris Zyp [email protected]
To: kriszyp/xstyle [email protected]
Cc: jfgilliam [email protected]
Sent: Thursday, February 13, 2014 1:10 PM
Subject: Re: [xstyle] css module hangs when file doesn't exist (#25)

Do you have a way of determining (through some configuration) if the css module should be loaded prior to attempting to load it? Or do you want to just always try to load and see if there is a 404? Do you need notification for when the CSS was loaded? If you just need to request a stylesheet, you can do so like this: https://github.com/kriszyp/xstyle/blob/master/core/load-css.js#L103
If you need to be notified, you can use that plugin module. You could also conditionally call the load method based on some configuration information, if you have that available to you.

Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants