How to include libraries files

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

How to include libraries files

vpena
Hi,

I'm working on a HTML exporter and I need to attach some libraries for
it to work (d3.js and other files .js, .css, etc). So I would like to
include them and if possible extract them when I generate my html file.
In Pharo I can encode a zip file, attach the codification of it to a
method and then extract it. Is there any way to do that? If not, is
there any other way to include the libraries files?

Thank you,
Vanessa.
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: How to include libraries files

Holger Kleinsorgen
Hello,

not 1:1 like in your example, but this basically does the same job:

- Load the parcel "Assets-IDE"
- create a subclass of class Assets, e.g. "HTMLAssets"
- on the class side, implement

   HTMLAssets class>>import_zip: aFilename
        ^ self importBytes: aFilename

- in the refactoring browser, open the context menu on the class HTMLAssets. Select "Sync assets". Point it to a directory containing the ZIP file. The assets IDE will  import all files in the directory which match a known file extension (see the various #import_ext: methods in class Assets)

- HTMLAssets should now contain a method named similar to the ZIP archive (without extension), e.g. "style.zip" is imported as #style.

- In your HTML exporter, extract the assets (requires Compression-Zip):
     (Zip.Archive on: HTMLAssets stylereadStream) extractTo: 'd:\'
  You'll need to add the parcel "Assets"  as prerequisite for deployments. Assets-IDE is for development.

vpena wrote
I'm working on a HTML exporter and I need to attach some libraries for
it to work (d3.js and other files .js, .css, etc). So I would like to
include them and if possible extract them when I generate my html file.