I'm using the GSP Resources plugin (http://grails.org/plugin/gsp-resources) to allow me to use GSP tags inside my css files. However, I'm getting a weird error when using the "resource" tag. Here's the line causing the problem:
background: transparent url(${resource(dir: 'static/images', file: 'servererror.png')}) 0.5em 50% no-repeat;
I get the following two errors on application start up:
2014-01-21 09:39:03,608 [FileSystemWatcher: files=#248 cl=groovy.lang.GroovyClassLoader#484b2882] ERROR resource.ResourceMeta - Resource not found: /static/images/servererror.png
Error
2014-01-21 09:39:04,257 [FileSystemWatcher: files=#248 cl=groovy.lang.GroovyClassLoader#484b2882] ERROR resource.ResourceMeta - While processing /css/servererror.css, a resource was required but not found: /static/images/servererror.png
The resource is there. If I manually type in the path I can access it no problem. If I move the line causing the problem to the "html" gsp file it works. However, since Grails can't find it, it doesn't put in the path correctly in the css file.
Any help is highly appreciated.
Your best shot will be to manually type the path in the css file. The reason for the error is that, the resource is not able to process the resource tags in the css.
You can inject the css file using the Applicationresource.groovy in the conf folder.
grails-app/conf/applicationresources.groovy
modules = {
application {
resource url:'css/servererror.css'
}
}
Related
I have to say I am unclear on the real reason for the error, but my only observation is that this .css file is being treated as a Lua file for whatever reason, which is why we see the error below.
Module:Citation/CS1/styles.css
http://www.gwart.co.uk/Module:Citation/CS1/styles.css
Other related errors: http://www.gwart.co.uk/Les_Edwards
How can I either fix this issue or alternatively, if needed, make this be a file rather than a module
Probably the page is being parsed as Lua because the content model is "Scribunto". If the TemplateStyles extension is installed, an admin can apparently change the content model of the page from "Scribunto" to "sanitized-css" and the page will be parsed correctly.
Another approach if you are not an admin is to create a .css subpage in the Template namespace and then move it to the Module namespace. Creating it in the Template namespace automatically gives it the "sanitized-css" content model, and it keeps its content model when it is moved to the Module namespace.
There is a Phabricator ticket requesting that Module subpages ending in .css automatically have the "sanitized-css" content model, but I do not know what progress has been made on implementing that.
I have lot of CSS ressources for my website.
I decided to use gulp to concatenate all of them, by doing the following :
gulp.task('concat_style', function() {
return gulp.src(['./public/adminLTE/bootstrap/css/bootstrap.min.css',
'./public/adminLTE/dist/css/AdminLTE.min.css',
'./public/adminLTE/dist/css/skins/skin-red.min.css',
'./public/stylesheets/font-awesome.min.css',
'./public/stylesheets/ionicons.min.css',
/*and many more*/])
.pipe(concat('styles.min.css'))
.pipe(gulp.dest('./public/stylesheets/'));
});
NB: I know I could reference all the .css files with a wildcard expression but I first though my problem was caused by the order by which they were concatened, so I referenced them in the same order they are in my non-concatened version.
In the concatened version I get the following error :
Failed to decode downloaded font: http://localhost:3000/fonts/glyphicons-halflings-regular.woff2
OTS parsing error: invalid version tag
The link : http://localhost:3000/fonts/glyphicons-halflings-regular.woff2 works when I access it with my browser.
How can I solve this error ?
The problem was that I was concatenating my css with the default concat function of gulp, and the needed font was required by an #import directive (that must always be on top of css file, but was in the middle of the concatened css file).
I ended up using gulp-concat-css, it solved the problem
I have some problems with the ResourceManifest.cs of an Orchard custom module (let's call it 'testmodule'). In the manifest inside this testmodule I defined the following Style:
manifest.DefineStyle("Identifier123").SetUrl("dashboard.min.css");
that is located in the testmodule's Styles folder.
Now in the View (that is also located in the testmodule) I call:
Style.Require("Identifier123");
Unfortunately I get the following dashboard.min.css file added, instead of my file:
/Modules/Amba.ImagePowerTools/Styles/dashboard.min.css
When I rename my dashboard.min.css to dashboard2.min.css (and also in the manifest) it is working fine. Is this a normal behavior or some priority problem caused by Amba.ImagePowerTools? Can someone help me with this?
For a while now I have adopted the practice of writing my CSS in an .aspx page and serving that page as CSS. Primarily this is because a project I was involved on had a development 'CDN' before images were finally hosted on the actual CDN, so when it came to background images I needed a way of changing the URL through the web.config. I also get a few other perks like variables. A small sample:
#id
{
color: '<%= PrimaryColor %>';
background-image: url('<%= PrependCdnUrl("myimage.jpg") %>');
}
Since working on an MVC project I'd now like to incorporate CSS bundling into the original project (a webforms project). The problem I have, an .aspx page is not allowed to be bundled up, I get errors similar to:
(1,1): run-time error CSS1019: Unexpected token, found '<'
(1,2): run-time error CSS1019: Unexpected token, found '%'
...
Does anyone know how I could get this to work?
Short answer: It is not possible.
Long answer: It is possible through some hacks.
Actually there are 2 possibilities that pop into my mind that would accomplish this (they are not tested, not sure if they work out finally tough):
In your IIS you can define which filetype gets handled by which interpreter. You can try to define .css files to use the same interpreter as ASP.NET pages. (not sure if this works)
You can create an .aspx file instead of a .css file where you output the css code you need dynamically. Set the MIME type of the return stream from this dynamic css aspx page to the MIME type of CSS. Then reference your aspx page as css file
I have the following line inside a section of a panel:
.divider{
background-image: url("img/pspacer.png");
}
With the .png placed relative to the panel java/html sources
Wicket Autolink is enabled and works for other resources, such as .js and .css files.
the Url inside the CSS declaration is unmodified by Wicket and of course results in an error when requested form the browser.
java.lang.ClassNotFoundException: img
the error changes to a 404 Error if there is no collision with static resources. Yet the original problem remains, that the autolinker does not alter the reference.