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

On the fly Scss compiler could cache result #2783

Closed
vaadin-bot opened this issue Sep 10, 2012 · 4 comments
Closed

On the fly Scss compiler could cache result #2783

vaadin-bot opened this issue Sep 10, 2012 · 4 comments

Comments

@vaadin-bot
Copy link
Collaborator

Originally by @Artur-


The on the fly scss compiler in the servlet could cache the result and only recompile when there are changes. For this to work the scss compiler must be able to tell what files are used in the compilation process so the servlet can check the timestamps for these files.

By tracking max(timestamp) for the given styles.scss and the files used in the compilation the servlet can easily check if there are any modifications (any(timestamp) > max(timestamp)) to any files and only in that case recompile.


Imported from https://dev.vaadin.com/ issue #9532

@vaadin-bot
Copy link
Collaborator Author

Originally by @hesara


See also #14146

@vaadin-bot
Copy link
Collaborator Author

Originally by mrbrush


I propose a patch to this issue, so that the cache staleness checking mechanism also considers URIs pointing to classloader resources which themselves are located as files in the filesystem (typical for maven based dynamic web projects with the Serve modules without publishing option checked in the Tomcat server config in Eclipse).

#!patch
--- VaadinServlet.java	2014-12-05 01:46:50.649265500 +0100
+++ VaadinServlet.java	2014-12-05 02:19:58.627971400 +0100
@@ -77,6 +77,13 @@
             long newest = 0;
             for (String uri : sourceUris) {
                 File file = new File(uri);
+                if (!file.exists()) {
+                	//try finding it through the classloader
+                	URL url = getClass().getClassLoader().getResource(uri);
+                	if (url != null) {
+                		file = new File(url.getFile());
+                	}
+                }
                 if (file.exists()) {
                     newest = Math.max(newest, file.lastModified());
                 } else if (!uri.startsWith("VAADIN/")) {

@vaadin-bot
Copy link
Collaborator Author

Originally by mrbrush


Hmm, maybe also check for the URL's protocol, if it's file because it could also be something else.

@vaadin-bot
Copy link
Collaborator Author

Originally by @Legioth


Replying to mrbrush:

I propose a patch to this issue, so that the cache staleness checking mechanism also considers URIs pointing to classloader resources which themselves are located as files in the filesystem (typical for maven based dynamic web projects with the Serve modules without publishing option checked in the Tomcat server config in Eclipse).

Could you please create a separate ticket for this case, since this ticket has been closed for a while already.

If you want, you can also directly submit a patch to our code review system: https://vaadin.com/wiki/-/wiki/Main/Contributing+Code

@vaadin-bot vaadin-bot added this to the Vaadin 7.3.0.rc1 milestone Dec 9, 2016
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

1 participant