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

What to insert exactly when sc_static refers to an unknown file? #14

Open
mauritslamers opened this issue May 9, 2014 · 10 comments
Open

Comments

@mauritslamers
Copy link
Member

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?

@dcporter
Copy link
Member

dcporter commented May 9, 2014

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.

@mauritslamers
Copy link
Member Author

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.

@dcporter
Copy link
Member

dcporter commented May 9, 2014

Unless it's at the beginning of a multiline command…

@mauritslamers
Copy link
Member Author

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...

@topherfangio
Copy link
Contributor

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 :-)

@dcporter
Copy link
Member

dcporter commented May 9, 2014

It's in the neighborhood of zero, until the developer messes something up. Then it's usually one at a time.

@dcporter
Copy link
Member

dcporter commented May 9, 2014

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:'."

@topherfangio
Copy link
Contributor

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 :-)

@mauritslamers
Copy link
Member Author

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

@topherfangio
Copy link
Contributor

+1 - Sounds like a reasonable plan to me.

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

3 participants