Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Lukas Renggli
Have a look at JQGoogleLibrary, it includes the jQuery libraries
through Google. Compare it with JQDeploymentLibrary, it includes them
locally. You can find that pattern for other Javascript code too.

Also the class comment of WAFileLibrary is quite detailed. Feel free
to ask a follow-up question if any of the above is not clear.

Lukas

PS: I answered that mail on [hidden email],
because this is not really a Seaside-Development question.

2009/12/24 Conrad Taylor <[hidden email]>:

> Hi, I was wondering, where can one find the complete Seaside 3.0 API for
> referencing external stylesheets and javascript files?  Also, I would like
> to reference these files from other domains like google.com as well as the
> local disk.
> Thanks in advance,
> -Conrad
>
>
>
>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Conrad Taylor
Lukas, it seems that WAFileLibrary serves the static content from the image.  I'm really looking to serve all my static content (i.e. images, stylesheets, and javascripts files) from Apache or another web server.  I understand the Apache side of the configuration after reading sections 22.3.5 and 22.3.6 of the "Dynamic Web Development with Seaside".  Also, the WAFileLibrary seems like a great deal of work to an external resource.  In short, I was thinking that I could simply do the following:

stylesheets = #( "/stylesheets/main.css" "/stylesheets/a.css" "/stylesheets/main.css" ).
stylesheets do: [ :each |  html link with: [  self type: "text/css" href:  "/stylesheets/main.css" media: "screen" charset: "utf-8". ].
javascripts = #( "/stylesheets/main.css" "/stylesheets/a.css" "/stylesheets/main.css" ).
stylesheets do: [ :each |  html script with: [  self type:  "text/html" source:  "/stylesheets/main.css"  charset: "utf-8". ].

or something even easier

html link with: [  self all from: "/stylesheets" cache: true. ]. 'This will make all the stylesheets in /stylsheets available to the application.'

Now, I would like to insert the javascript files at the end of the page like this so that they are the last thing loaded when the page is rendered.

html script with: [  self all from: "/javascripts"  cache: true. ]. 'This will make all the javascript files in /javascripts available to the application.'

Also, I come from a Rails background where 'cache => true' will generate a file which contains all the javascripts and a file that contains all
the stylesheets respectively.  Other options can include "recursive:" and "fileName:"

-Conrad

On Thu, Dec 24, 2009 at 12:55 AM, Lukas Renggli <[hidden email]> wrote:
Have a look at JQGoogleLibrary, it includes the jQuery libraries
through Google. Compare it with JQDeploymentLibrary, it includes them
locally. You can find that pattern for other Javascript code too.

Also the class comment of WAFileLibrary is quite detailed. Feel free
to ask a follow-up question if any of the above is not clear.

Lukas

PS: I answered that mail on [hidden email],
because this is not really a Seaside-Development question.

2009/12/24 Conrad Taylor <[hidden email]>:
> Hi, I was wondering, where can one find the complete Seaside 3.0 API for
> referencing external stylesheets and javascript files?  Also, I would like
> to reference these files from other domains like google.com as well as the
> local disk.
> Thanks in advance,
> -Conrad
>
>
>
>
> _______________________________________________
> seaside-dev mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>
>



--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Lukas Renggli
> Lukas, it seems that WAFileLibrary serves the static content from the image.

Not necessarily, see JQGoogleLibrary.

>  I'm really looking to serve all my static content (i.e. images,
> stylesheets, and javascripts files) from Apache or another web server.

You can use the same approach if you serve from Apache.

If you don't want to create your own FileLibrary class you can also
override #updateRoot: in your root component with the same contents:

YourFileLibrary / YourRootComponent >> updateRoot: anHtmlRoot
        super updateRoot: anHtmlRoot.
        anHtmlRoot javascript
                url: 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'

Instead of #url: you might also want to use #resourceUrl: instead,
which uses the configured resource url path as the root.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Conrad Taylor
On Thu, Dec 24, 2009 at 4:42 AM, Lukas Renggli <[hidden email]> wrote:
> Lukas, it seems that WAFileLibrary serves the static content from the image.

Not necessarily, see JQGoogleLibrary.

>  I'm really looking to serve all my static content (i.e. images,
> stylesheets, and javascripts files) from Apache or another web server.

You can use the same approach if you serve from Apache.

If you don't want to create your own FileLibrary class you can also
override #updateRoot: in your root component with the same contents:

YourFileLibrary / YourRootComponent >> updateRoot: anHtmlRoot
       super updateRoot: anHtmlRoot.
       anHtmlRoot javascript
               url: 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'

Lukas, I saw example within the JQGoogleLibrary and I guess the following is legal as well:


Finally, it wasn't clear how to set the charset for both the javascript and stylesheet files.

-Conrad
 

Instead of #url: you might also want to use #resourceUrl: instead,
which uses the configured resource url path as the root.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Lukas Renggli
> Lukas, I saw example within the JQGoogleLibrary and I guess the following is
> legal as well:
> https://gist.github.com/29774f07f9a1468140f9

Yeah, the setup is fine.

    anHtmlRoot stylesheet
        url: 'http://www.example.com/stylesheets/main.css';
        url: "/stylesheets/one.css";
        url: "/stylesheets/two.css";
        url: "/stylesheets/three.css".

The above code however will only include "/stylesheets/three.css",
because it creates a single style tag where the #url: attribute is
overridden 3 times. This is exactly the same as with the rendering
method #renderContentOn:

The same goes for your #meta configuration.

Furthermore in my version of Seaside #headElements returns an ordered
collection. So I don't think that your code that calls #headElements
works.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Re: [Seaside-dev] Seaside 3.0 API for accessing external stylesheet and javascript files?

Conrad Taylor
Lukas, thanks for all the information and I really appreciate it.  I'm just trying to wrap my hands around the HTML part of the API.

-Conrad

On Thu, Dec 24, 2009 at 6:44 AM, Lukas Renggli <[hidden email]> wrote:
> Lukas, I saw example within the JQGoogleLibrary and I guess the following is
> legal as well:
> https://gist.github.com/29774f07f9a1468140f9

Yeah, the setup is fine.

   anHtmlRoot stylesheet
       url: 'http://www.example.com/stylesheets/main.css';
       url: "/stylesheets/one.css";
       url: "/stylesheets/two.css";
       url: "/stylesheets/three.css".

The above code however will only include "/stylesheets/three.css",
because it creates a single style tag where the #url: attribute is
overridden 3 times. This is exactly the same as with the rendering
method #renderContentOn:

The same goes for your #meta configuration.

Furthermore in my version of Seaside #headElements returns an ordered
collection. So I don't think that your code that calls #headElements
works.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside