-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
What to insert exactly when sc_static refers to an unknown file? #14
Comments
I believe Abbot goes exactly that route. The terminal message is the only developer warning that's available, I believe. Not sure how you would insert one into the code. |
By adding a SC.warn() line after the image url in debug mode (devserver mode). That will cause the dev warning to also show in the browser console. |
Unless it's at the beginning of a multiline command… |
or defined as value in a key-value list. There is one option still, which is to add it as last line of the offending file... |
I like the last line of the file option, especially if you can add the original line to the message. Do you have a rough idea of how many times this occurs in a freshly generated SC app? If it's in the neighborhood of 5-10, I'd say the message will be useful. If it's like 100, then we may want to consider a different approach so that we don't have a massive amount of output that the end-developer can't assist with. Just some thoughts :-) |
It's in the neighborhood of zero, until the developer messes something up. Then it's usually one at a time. |
I'm not sure about needing to put it in the same file. How would it handle sc_static calls in CSS files, for example? I'm not sure they need to be, though – just say what the missing filename was, and folks can search their code for it. And we can include some information about the now-required framework_name: prefix – "The following static files were referenced via sc_static() but were not found. If you are referencing a file in another framework, you must prefix it with 'other_framework_name:'." |
That's a good point about the CSS. Can we just keep track of all of the instances where something is missing and add it at the end of the app's main.js/core.js (or just inject it into the output stream)? I'm still not sure I understand quite how everything is working at the moment so please excuse and stupidity :-) |
In a dev server situation it is not too difficult to gather these warnings and attach them to the index.html in the form of a script giving a set of warnings, which then can also be used for other warnings |
+1 - Sounds like a reasonable plan to me. |
When performing sc_static replacement of the tests application, it turns out it is referring to a picture which doesn't exist in the app.
For now, the BT will display a message to stdout (terminal), and replace sc_static with an empty string, but should perhaps also a developer warning be inserted as well?
The text was updated successfully, but these errors were encountered: