[Seaside] How can I specify path to css and js libs?

Esteban A. Maringolo emaringolo at gmail.com
Sat Oct 11 01:23:44 UTC 2014

Is the "siteX" stable? or is something dynamic?

If it is stable you can define a FileHandler at '/siteX/', and then in
your code generate the URL's using WAFileHandler's #urlOf:using:

| fileHandler |
fileHandler := WAFileHandler new.
fileHandler preferenceAt: #resourceBaseUrl put: (WAUrl absolute: 'siteX') .
(fileHandler libraryAt: #TBSDeploymentLibrary ifAbsent: []) default
urlOf: #cssbootstrapminCss using: fileHandler.

At runtime I guess you would ask the FileHandler to your dispatcher
(or the default).
| fileHandler  |
fileHandler := WADispatcher default handlerAt: 'siteX' ifAbsent:[].
(fileHandler libraryAt: #TBSDeploymentLibrary ifAbsent: []) default
urlOf: #cssbootstrapminCss using: fileHandler.

It's a little convoluted for my taste, however.

Maybe simply setting #resourceBaseUrl to 'siteX' in your WAApplication
(at root) would do the trick.

ps: another option is to use an extension based pattern in nginx,
using try_files for all requests of "static" content (I didn't test

location ~* \.(?:jpg|jpeg|gif|css|png|js)$ {
   try_files $uri;
   expires           30d;
   # etc...

See http://serverfault.com/questions/537569/nginx-serve-static-files-directly-if-not-matched-by-rewrite-rules


Esteban A. Maringolo

2014-10-10 16:12 GMT-03:00 Mariano Martinez Peck <marianopeck at gmail.com>:
> Hi guys,
> I am currently serving my css and js static files with nginx. But so far,
> all these were generated in the default root path. For example:
> <script type="text/javascript"
> src="/JQDevelopmentLibrary/jQuery.js"></script>
> <link rel="stylesheet" type="text/css"
> href="/TBSDevelopmentLibrary/css/bootstrap.css"/>
> etc...
> Now...I would like to be able to set a different prefix path. For example,
> 'siteX', and then urls become:
> <script type="text/javascript"
> src="/siteX/JQDevelopmentLibrary/jQuery.js"></script>
> <link rel="stylesheet" type="text/css"
> href="/siteX/TBSDevelopmentLibrary/css/bootstrap.css"/>
> Why I want this?  Because I want to be able to catch these into nginx
> locations and search the files in different places.
> Any idea how can I do this?
> Thanks,
> --
> Mariano
> http://marianopeck.wordpress.com
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

More information about the seaside mailing list