Grails assets directory management - grails

To my Grails project, I use ztree library.
In the css of this library, we have the following :
background-image:url("/ztree/img/zTreeStandard.png")
I have 3 directory in assets/
images/
javascripts/
stylesheets/
I don't want to modify the css to change the path of background-image:url("/ztree/img/zTreeStandard.png").
So, here are my questions :
Is that mandatory to create a ztree directory in assets/ ?
Can I put ztree directory in images/ ?
Thanks,

If you store the image at grails-app/assets/images/ztree/img/zTreeStandard.png, the assets-pipeline plugin should be able to resolve it (I haven't tested this). If it doesn't work, the reason will be because of the leading / in the path
background-image:url("/ztree/img/zTreeStandard.png")
I understand that you don't like modifying 3rd party code, but I don't think you'll have any choice other than to change this to
background-image:url("ztree/img/zTreeStandard.png")

I would recommend creating a assets/vendor directory and you can just dump all your third-party libraries in there. It should be smart enough for you not have to change any paths--though the absolute URLs might mess things up since usually grails is running at http://host:port/app-name/.

Related

Jenkins thinBackup - include additional folder

When using the thinBackup Jenkins plugin one can configure it to include additional files. It seems impossible to include whole additional folders though.
In our case (see screenshot below) it is adding the secret.* files properly but does fail to include the secrets folder (or in the case shown here the .key files in the secrets folder).
Are we configuring this wrong or is it just not possible to include arbitrary folders?
I played around with regex and if you want to backup all the files in secrets folder, try below regex.
It works fine
^(.*\.xml)|^(secrets|.*\.key|.*\.KEY|.*\.Secret|.*\.secret|.*\.mac|.*\.MAC|.*\.seed|.*\.crumbSalt|.*\.consoleAnnotator|.*\.serverCookie|.*\-switch|whitelisted\-callables\.d|.*\.conf|filepath\-filters\.d|.*\.conf)$
You actually need to use the vertical bar to represent a folder or subfolder. I believe the fix for your regex in the screenshot would be changing (secrets/.*.key) to:
(secrets|.*\.key)
Any further subfolders have a similar syntax, such as getting *.groovy from jenkins/scriptler/scripts/:
(scriptler|scripts|.*\.groovy)
Maybe you've already figured this out, but if not, I hope this helps.
Bill

Minify using pom.xml

is it possible to minify css and js files inside a specific folder and then use the minified files for a file, let's say the index.html.? Im thinking of using the pom.xml then use the maven-minify-plugin and the replacer plugin but I can't find a good structure.
you should use the static-helper-maven-plugin from WUIC project (http://wuic.github.io/)
The maven plugin relies on WUIC to parse the index.html of your workspace, collects js/css used inside it, resolve them, minify them, aggregate them and rewrite the index.html with a version number in URLs to burst client cache in case of any change.
wiki: https://github.com/wuic/wuic/wiki/Process-at-build-time
The WUIC's website is generated optimized with this approach:
- source: https://github.com/wuic/wuic.github.io
- result: https://github.com/wuic/wuic.github.io/tree/master

How is gulp-bower used and what is it for?

I am trying to solve this problem; Apparently when I use my gulp file I can't link to my bower_components folder.
While trying to come up with a solution, I heard of gulp-bower But the docs seem a little vague. So what is gulp-bower used for? Could this help me?
Anyone run into my problem? Is my gulp file too verbose...
Just as a FYI I set up a components folder which houses index, scss, images and js and I use gulp to stream to a DEV or PROD depending on the situation. But alas I think that maybe the problem...
PATH STRUCTURE
This was supposed to be an answer to your original question, but it's suitable here as well.
You can't refer to scripts that are out on top of serving directory of your web server.
You could however link to it, if you're on linux, that would be a ln -s.
But, there's a better way. Add .bowerrc to where you install your bower components from, and add this to it:
{
"directory": "folder/in/a/serving/directory"
}

SproutCore IPAD

I am working on a SproutCore project. I am trying to get the site as is on the IPAD, but the CSS background images, onClick and redirect is not working on the IPAD.
Let me know any solution on this.
When developing on the iPad, I have found the following to be useful in my Buildfile:
mode :debug do
config :all, :combine_javascript => true
end
Most iOS devices tend to have difficulty loading a large number of Javascript files, and this will concatenate them all into one. This may or may not resolve your issues, but many issues manifest if you leave them as separate files.
Also, do you have any errors in the debugger that you could share? It might help us track down the issue.
For broken images/CSS after building, it's often a relative path issue.
You might want to check your CSS / image paths in your compiled CSS & index.html files.
After building the project, look inside your output directory and try the following:
Open index.html file in your browser, and see which CSS/image files are not loading correctly.
Find your index.html file and replace instances of "/static" with "static"
Find stylesheet-packed.css & stylesheet#2x-packed.css and replace instances of "/static" with "../../../static" (or whatever fixes the path in your case)
I have build.sh script to automate this and it works for me. Let me know if you want it.. Good luck!

Symfony admin generator generated module has no style

I am using Symfony 1.31 for a brand new project. I have just created a module in the backend app, using the admin generator. To my suprise, it seems no theme ((At all) has been applied to the pages. As I mentioned before, this si abrand new project - I have not even modified the /app/backend/layout.php file yet.
I rember having a similar problem before - I dont remmber how I solved it (I think I had to run a task or copy some files over to the /web folder before the styles/images etc came into efect. Can anyone refresh my memory?
You might need to run the plugin:publish-assets command:
php symfony plugin:publish-assets
This will create symlinks to your plugins' web/ directory inside your project's web/, thus enabling access to sfDoctrinePlugin's (or propel depending what ORM you use) admin-gen styles.
Check your apache configuration and files permissions, and especially the alias to the /sf/ subdirectory. It seems that the .css file corresponding to sf_admin pages are not accessible. You can fix it by adding an Alias to your virtualhost configuration, or allowing symlinks.
(By the way, hint: check your html source, find out the .css url, and try to access it directly with your browser)

Resources