I have an annoying problem with my new grails app. I'm trying to mock up a design for a site that I will be making but whenever I do changes in my css it won't affect the running application. No matter how big changes I do I have to stop the application and then run it again.
This is very frustrating, I've turned of cache in Chrome and even if I go to the specific document the resource is still the old. What can I do to solve this problem? I can make changes in my gsp files and the changes will appear but not in my css.
I am currently loading the resource within a layout file like this:
<link rel="stylesheet" href="${resource(dir: 'css', file: 'app.css')}" type="text/css">
If you need me to provide any more information, please just ask. I am using grails 2.2.0.
Add this to your Config.groovy (probably just for development)
grails.resources.debug = true
Read the docs for more info.
It looks like Gregg's answer doesn't work for 1.3.7 (maybe that is something added in 2.x?). A method I found that makes quick CSS updates possible is to include a separate GSP as a template in the page header.
That is, create a file called "_css.gsp" (underscore prefix is required) in the same directory as your view files, fill it with standard css surrounded by html style tags, and then include the following in your layout header or page:
<g:render template="css" />
With that in place, the content of _css.gsp is injected into the page. And I can make changes to _css.gsp and they are immediately reflected after page refresh without having to restart Grails. Hope this helps someone in Grails pre-2.x!
Related
Edit : I don't know if it actually loads from cache, so I can't create the question named "prevent from loading cache".
Problem : Browsers sometimes save my code and keep loading only the code they saved(Maybe it saves in the cache). When this problem occurs, browser is like caching the old code and won't change anything. This is to say, It won't load any new code I updated.
Information: This occurs in HTML, CSS, Javascript on all browsers. I am using Apache in XAMPP as an appserv.
Deleting cache in all browsers won't fix this.
My first way to stop this is to delete the file, refresh browser and replace it.
The second ways is changing the pathname.
After the fix, the problem will occur again at anytime :(, so I would like to know how to prevent this.
Edited: If possible, please explain for newbie because I am very young beginner.
Try adding a variable like current timestamp to each url in its query string.
Just use querystring e.g. http://www.domain.com/style.css?version=1 for first version.
Now you update the stylesheet and you would like to reflact changes to all users browser who have cached version of old stylesheet. for this just change version querystring value to 1.1
e.g. http://www.domain.com/style.css?version=1.1
This works for javascript, css and all other files called in by your html page.
Also for all files like html, css, js, you can eTag header. More information can be found here.
http://www.w3.org/2005/MWI/BPWG/techs/CachingWithETag.html
When someone navigates to my Meteor app, I would like the home page to be loaded first, rendered, and displayed. And then as soon as this is done (the user can start clicking around), all the other resources and databases for all pages of my app are loaded (cached) in the background to LocalStorage (as much as can fit), so that all the pages, images, etc, of my app will appear instantly when navigated to.
What's the no-brainer convention for doing this in Meteor? Is there a package?
And secondly, how do I indicate which resources I want to be highest priority in the background loading queue? For example, how do I make sure that a "splash page" and its images shows up right away?
Meteor apps are, by design, single-page sites. If you view-source on a deployed Meteor app, for example http://docs.meteor.com, the <head> always looks something like this:
<link rel="stylesheet" href="/5a6084946b1bc47e30e45c05bdecb13536a2dc64.css">
<script type="text/javascript">
__meteor_runtime_config__ = {"meteorRelease":"galaxy-follower-5","ROOT_URL":
"http://docs.meteor.com","ROOT_URL_PATH_PREFIX":"","serverId":
"964b34dc-ffbb-b860-a313-9eedca254d83","DDP_DEFAULT_CONNECTION_URL":
"ddp+sockjs://ddp--****-docs.meteor.com/sockjs"};
</script>
<script type="text/javascript" src="/3353c2b059d42f3fe42e0d5eba87882b955d7cbe.js">
</script>
That .css file is all of your app's CSS, concatenated into one file; and that .js file is all of your app's JavaScript, including all of your templates, concatenated into one file. That's just the way Meteor is designed, and it's not something you can change without delving deep into Meteor's source and rewriting some major chunks.
The only suggestion I have for you is to have your homepage served by something else, such as an Apache or Nginx server, which really does serve up just the bare minimum that you're after; and fetches the above .css and .js files and preloads them. Use a router package in your Meteor app, and take care that all the links in your homepage point to routes that are defined in the Meteor app. You can also speed things up a bit by separating out and loading from a CDN or your Apache/Nginx server any resources not directly needed by Meteor—images, additional CSS, external JavaScript like libraries—and having those preloaded by your non-Meteor-hosted homepage.
Finally take a look at meteor-external-file-loader. It's designed for loading external JavaScript libraries on the fly in Meteor apps, for example loading Google Maps only on the pages where you're actually showing maps. I'm not sure if it can be used to load JavaScript that's core to your app like templates, but if your app is so large that you're thinking of splitting it up anyway then presumably there are parts of your code that you can separate into packages like your own custom JavaScript libraries, which can then be loaded dynamically from your Apache/Nginx server using meteor-external-file-loader.
I want to change the look and feel(ui customization) of Jenkins. Also I would like to add new views(say like new html pages or web pages) with navigation to the required jenkins pages etc.
Please let me know if any single plugins will help me to do so.Any relevant information(how ever generic) will be very helpful.
Any suggestions or links or tutorials is also appreciated.
PS:- Pretty new to jenkins.The inputs from here will help me to add more details to the questions.
I am looking for documents or tutorials that specify Skinning Jenkins using plugins like :-
https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/jQuery+UI+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/JSWidgets+Plugin
The plugin page is providing very little information on how to use these and the benefits and the extend to which the UI can be changed.
Any doc or link is appreciated.
Assuming you don't want to write a Jenkins plugin, for adding pages, the best suggestion I can make is to use an HTTP proxy such as NginX, and configure it so that the pages you want to add are plain html files, and Jenkins is proxied for the rest of them. To a visitor, they will look like they are all part of the same site; you could copy code from the head and body sections of Jenkins-served pages to include some of the navigation.
The Simple Theme Plugin, which you found, will let you do basic customization of the look and feel of Jenkins. I do that for my build server and proxy it using this configuration fragment for NginX. The relevant CSS is in this CSS file - toward the end, look for the // JENKINS CUSTOMIZATION comment.
We use the Simple theme plugin - pointed at a css file for the simple styling, and a JS file to fix a couple of DOM oddities (some of the tables in the new look and feel have mismatching column counts).
Those two files need only be hosted either a handy http server, or you can place them in usercontent.
You need only refresh the page in the browser to see the changes. Both files can then happily reference other files served up too.
Handy things to note:
Jenkins has jquery, parts of YUI loaded and prototype loaded - so you can use them in your scripts.
If while debugging, the refresh gets in the way then use the console to enter the following to temporarily stop it without pausing JS: refreshPart = function() {}
When making DOM tree changes to content that is refreshed - attach it to the layout updates with:
layoutUpdatecallback.add(my_function) - that way your changes are applied to new incoming content.
I have an application with a subdomain for each customer. They can change the look and feel, which is all based on Twitter Bootstrap. When they save their settings, the app creates a .less stylesheet for them, where the appropriate Twitter Bootstrap variables have been set to their liking.
I the appropriate stylesheet in my application.html.erb file based on what subdomain was accessed. I know that won't work in production.
I'd like to invoke something to compile it as it is saved. Any thoughts?
It sounds like you need to be able to trigger Sprocket compilation of these files on demand during run time. I have no experience with it, but this guy has:
http://www.krautcomputing.com/blog/2012/03/27/how-to-compile-custom-sass-stylesheets-dynamically-during-runtime/
People are telling me that I need a script loading for web app, but I already have <script /> and <link /> tags already, can anyone tell me when I should use a script or resource loader? and What is the load you recommend.
I'm assuming they are referring to loading and executing javascript files as and when needed, to reduce the initial load times of pages by not loading all your scripts in the head section of the html.
Not totally sure if thats what your getting out, could you give more information on the situation? does your web app have a large number of javascript tags?
I think the requirement of the scripts loader is for multiple <script src=""> tags in the html page, one of more of the scripts have the loading order required, like: the jquery.js must be loaded before the jquery-plugin.js. Another case is the scripts which will be loaded are different in different client devices, like the javascript run for desktop client will be different than the javascript run in the touch pad
When you are working on a single-page application with a lot of dependencies between JS files.