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

Script/CSS to external files #137

Open
brianjacobs-natgeo opened this issue Oct 15, 2020 · 2 comments
Open

Script/CSS to external files #137

brianjacobs-natgeo opened this issue Oct 15, 2020 · 2 comments

Comments

@brianjacobs-natgeo
Copy link

Hi, I'm curious about this: have there been any efforts to write scripts/css to files rather than inlined? Seems pretty doable within generateOutputHtml but wondering if there's any obvious gotchas before going down this road.

@martgnz
Copy link

martgnz commented Oct 15, 2020

Hi Brian, it is certainly possible and it would be nice to have the option upstream.

I have done something like this in generateOutputHtml:

saveTextFile(htmlFileDestinationFolder + 'style.css', css);

And then don't forget to add a comment block referencing your stylesheet:

commentBlock += '\t<link rel="stylesheet" href="style.css" />\r';

@brianjacobs-natgeo
Copy link
Author

Thanks. Along those lines worked. I'm importing the css/js files elsewhere so I dont want to add the reference to the files directly in the comment block.

What was also important: removing <script> and <style> tags before saving the content into their own files

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