Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

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

Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Hannes Hirzel
**Update:**

The question you are asking seems to be

"How do I use a third-party JavaScript library in an Amber".

This is a question which needs to be answered in the FAQ
http://docs.amber-lang.net/faq.html
Currently it is not.


Answers so far

On the wiki FAQ there are three answers which answer part of it or
help with problems when importing third party libraries.

https://github.com/amber-smalltalk/amber/wiki/FAQ#i-am-integrating-a-javascript-library-and-i-need-to-add-its-amdjson-file-what-should-i-use-as-path-there

https://github.com/amber-smalltalk/amber/wiki/FAQ#why-should-i-not-refer-to-min-files-in-amdjson-files

https://github.com/amber-smalltalk/amber/wiki/FAQ#my-imports-is-invalid-and-my-app-fails-to-load-so-i-cannot-get-to-ide-how-to-recover


Here is a draft of a HowTo
https://trello.com/c/gbecTh6f/19-integrate-a-javascript-library

And a complete example together with the description how it was done

https://github.com/hhzl/Amber-snapsvg-demo

I opened an issue for this

     https://github.com/amber-smalltalk/amber-documentation/issues/55

@Everybody, please help to develop the answer on the wiki in the upcoming days.

here https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-a-use-a-third-party-javascript-library-in-an-amber-project

As the information is laying around at different places. It just needs
to be put together.

Afterwards we will move the finalized answer to the more prominent
place at  http://docs.amber-lang.net/faq.html


--Hannes



On 4/10/15, H. Hirzel <[hidden email]> wrote:

> Vicnet
>
> As Herby notes you need to construct a file
>
>    papaparse.amd.json
>
> (Note: not papaparser.amd.json; your bower command uses a wrong name).
>
> More on this here
>
> http://stackoverflow.com/questions/27374889/how-to-add-a-non-amber-library-with-bower-for-example-processing-js
>
> HTH
>
> --Hannes
>
> BTW which is the repo you are working with?
>
> On 4/10/15, Herby Vojčík <[hidden email]> wrote:
>>
>>
>> H. Hirzel wrote:
>>> I thought there is a draft for a how for this?
>>
>> I don't know, sorry. Not to mention I am that much forward that I can't
>> even imagine what real users out there struggle with when trying to
>> catch up from pre-0.13 (or even older) codebases. For me, 0.13 is
>> already antiquity.
>>
>> I hope you have better overview, after Sebastian disappeared from the
>> documentation work, I hope you are now the best candidate for The One
>> Who Knows His Way Around Docs.
>>
>>> On 4/10/15, Herby Vojčík<[hidden email]>  wrote:
>>>>
>>>> Vicnet wrote:
>>>>> Hello,
>>>>>
>>>>> I try to install papaparser (http://papaparse.com/) with this command:
>>>>> bower install papaparser --save
>>>>> grunt devel
>>>>>
>>>>> The lib is installed in bower_components and in bower.json but not in
>>>>> config.js nor in the.js.
>>>>>
>>>>> So the lib could be imported in my package !
>>>>>
>>>>> What is wrong ?
>>>> You don't have amd paths mapping.
>>>>
>>>> Which you must must put in<project root>/papaparser.amd.json (in case
>>>> the
>>>> directory under bower_components is called papaparser).
>>>>
>>>>> a+
>>>>> Vicnet
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups
>>>> "amber-lang" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an
>>>> email to [hidden email].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "amber-lang" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [hidden email].
>> For more options, visit https://groups.google.com/d/optout.
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Hannes Hirzel
The place to put the answer

https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-i-use-a-third-party-javascript-library-in-an-amber-project

(fixed spelling error)

On 4/11/15, H. Hirzel <[hidden email]> wrote:

> **Update:**
>
> The question you are asking seems to be
>
> "How do I use a third-party JavaScript library in an Amber".
>
> This is a question which needs to be answered in the FAQ
> http://docs.amber-lang.net/faq.html
> Currently it is not.
>
>
> Answers so far
>
> On the wiki FAQ there are three answers which answer part of it or
> help with problems when importing third party libraries.
>
> https://github.com/amber-smalltalk/amber/wiki/FAQ#i-am-integrating-a-javascript-library-and-i-need-to-add-its-amdjson-file-what-should-i-use-as-path-there
>
> https://github.com/amber-smalltalk/amber/wiki/FAQ#why-should-i-not-refer-to-min-files-in-amdjson-files
>
> https://github.com/amber-smalltalk/amber/wiki/FAQ#my-imports-is-invalid-and-my-app-fails-to-load-so-i-cannot-get-to-ide-how-to-recover
>
>
> Here is a draft of a HowTo
> https://trello.com/c/gbecTh6f/19-integrate-a-javascript-library
>
> And a complete example together with the description how it was done
>
> https://github.com/hhzl/Amber-snapsvg-demo
>
> I opened an issue for this
>
>      https://github.com/amber-smalltalk/amber-documentation/issues/55
>
> @Everybody, please help to develop the answer on the wiki in the upcoming
> days.
>
> here
> https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-a-use-a-third-party-javascript-library-in-an-amber-project
>
> As the information is laying around at different places. It just needs
> to be put together.
>
> Afterwards we will move the finalized answer to the more prominent
> place at  http://docs.amber-lang.net/faq.html
>
>
> --Hannes
>
>
>
> On 4/10/15, H. Hirzel <[hidden email]> wrote:
>> Vicnet
>>
>> As Herby notes you need to construct a file
>>
>>    papaparse.amd.json
>>
>> (Note: not papaparser.amd.json; your bower command uses a wrong name).
>>
>> More on this here
>>
>> http://stackoverflow.com/questions/27374889/how-to-add-a-non-amber-library-with-bower-for-example-processing-js
>>
>> HTH
>>
>> --Hannes
>>
>> BTW which is the repo you are working with?
>>
>> On 4/10/15, Herby Vojčík <[hidden email]> wrote:
>>>
>>>
>>> H. Hirzel wrote:
>>>> I thought there is a draft for a how for this?
>>>
>>> I don't know, sorry. Not to mention I am that much forward that I can't
>>> even imagine what real users out there struggle with when trying to
>>> catch up from pre-0.13 (or even older) codebases. For me, 0.13 is
>>> already antiquity.
>>>
>>> I hope you have better overview, after Sebastian disappeared from the
>>> documentation work, I hope you are now the best candidate for The One
>>> Who Knows His Way Around Docs.
>>>
>>>> On 4/10/15, Herby Vojčík<[hidden email]>  wrote:
>>>>>
>>>>> Vicnet wrote:
>>>>>> Hello,
>>>>>>
>>>>>> I try to install papaparser (http://papaparse.com/) with this
>>>>>> command:
>>>>>> bower install papaparser --save
>>>>>> grunt devel
>>>>>>
>>>>>> The lib is installed in bower_components and in bower.json but not in
>>>>>> config.js nor in the.js.
>>>>>>
>>>>>> So the lib could be imported in my package !
>>>>>>
>>>>>> What is wrong ?
>>>>> You don't have amd paths mapping.
>>>>>
>>>>> Which you must must put in<project root>/papaparser.amd.json (in case
>>>>> the
>>>>> directory under bower_components is called papaparser).
>>>>>
>>>>>> a+
>>>>>> Vicnet
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> "amber-lang" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an
>>>>> email to [hidden email].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "amber-lang" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> email to [hidden email].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Hannes Hirzel
@Herby

Thank you for the newly created Question and Answer

https://github.com/amber-smalltalk/amber/wiki/FAQ#my-imports-is-invalid-and-my-app-fails-to-load-so-i-cannot-get-to-ide-how-to-recover

yesterday.

On 4/11/15, H. Hirzel <[hidden email]> wrote:

> The place to put the answer
>
> https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-i-use-a-third-party-javascript-library-in-an-amber-project
>
> (fixed spelling error)
>
> On 4/11/15, H. Hirzel <[hidden email]> wrote:
>> **Update:**
>>
>> The question you are asking seems to be
>>
>> "How do I use a third-party JavaScript library in an Amber".
>>
>> This is a question which needs to be answered in the FAQ
>> http://docs.amber-lang.net/faq.html
>> Currently it is not.
>>
>>
>> Answers so far
>>
>> On the wiki FAQ there are three answers which answer part of it or
>> help with problems when importing third party libraries.
>>
>> https://github.com/amber-smalltalk/amber/wiki/FAQ#i-am-integrating-a-javascript-library-and-i-need-to-add-its-amdjson-file-what-should-i-use-as-path-there
>>
>> https://github.com/amber-smalltalk/amber/wiki/FAQ#why-should-i-not-refer-to-min-files-in-amdjson-files
>>
>> https://github.com/amber-smalltalk/amber/wiki/FAQ#my-imports-is-invalid-and-my-app-fails-to-load-so-i-cannot-get-to-ide-how-to-recover
>>
>>
>> Here is a draft of a HowTo
>> https://trello.com/c/gbecTh6f/19-integrate-a-javascript-library
>>
>> And a complete example together with the description how it was done
>>
>> https://github.com/hhzl/Amber-snapsvg-demo
>>
>> I opened an issue for this
>>
>>      https://github.com/amber-smalltalk/amber-documentation/issues/55
>>
>> @Everybody, please help to develop the answer on the wiki in the upcoming
>> days.
>>
>> here
>> https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-a-use-a-third-party-javascript-library-in-an-amber-project
>>
>> As the information is laying around at different places. It just needs
>> to be put together.
>>
>> Afterwards we will move the finalized answer to the more prominent
>> place at  http://docs.amber-lang.net/faq.html
>>
>>
>> --Hannes
>>
>>
>>
>> On 4/10/15, H. Hirzel <[hidden email]> wrote:
>>> Vicnet
>>>
>>> As Herby notes you need to construct a file
>>>
>>>    papaparse.amd.json
>>>
>>> (Note: not papaparser.amd.json; your bower command uses a wrong name).
>>>
>>> More on this here
>>>
>>> http://stackoverflow.com/questions/27374889/how-to-add-a-non-amber-library-with-bower-for-example-processing-js
>>>
>>> HTH
>>>
>>> --Hannes
>>>
>>> BTW which is the repo you are working with?
>>>
>>> On 4/10/15, Herby Vojčík <[hidden email]> wrote:
>>>>
>>>>
>>>> H. Hirzel wrote:
>>>>> I thought there is a draft for a how for this?
>>>>
>>>> I don't know, sorry. Not to mention I am that much forward that I can't
>>>> even imagine what real users out there struggle with when trying to
>>>> catch up from pre-0.13 (or even older) codebases. For me, 0.13 is
>>>> already antiquity.
>>>>
>>>> I hope you have better overview, after Sebastian disappeared from the
>>>> documentation work, I hope you are now the best candidate for The One
>>>> Who Knows His Way Around Docs.
>>>>
>>>>> On 4/10/15, Herby Vojčík<[hidden email]>  wrote:
>>>>>>
>>>>>> Vicnet wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I try to install papaparser (http://papaparse.com/) with this
>>>>>>> command:
>>>>>>> bower install papaparser --save
>>>>>>> grunt devel
>>>>>>>
>>>>>>> The lib is installed in bower_components and in bower.json but not
>>>>>>> in
>>>>>>> config.js nor in the.js.
>>>>>>>
>>>>>>> So the lib could be imported in my package !
>>>>>>>
>>>>>>> What is wrong ?
>>>>>> You don't have amd paths mapping.
>>>>>>
>>>>>> Which you must must put in<project root>/papaparser.amd.json (in case
>>>>>> the
>>>>>> directory under bower_components is called papaparser).
>>>>>>
>>>>>>> a+
>>>>>>> Vicnet
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups
>>>>>> "amber-lang" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send
>>>>>> an
>>>>>> email to [hidden email].
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups
>>>> "amber-lang" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an
>>>> email to [hidden email].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Hannes Hirzel
Added a note

There seems to be a distinction between

- Third party JavaScript libraries which are registered in bower.io
and those which are not.
- And then there is a distinction if the external library is an AMD
module or not.


On 4/11/15, H. Hirzel <[hidden email]> wrote:

> @Herby
>
> Thank you for the newly created Question and Answer
>
> https://github.com/amber-smalltalk/amber/wiki/FAQ#my-imports-is-invalid-and-my-app-fails-to-load-so-i-cannot-get-to-ide-how-to-recover
>
> yesterday.
>
> On 4/11/15, H. Hirzel <[hidden email]> wrote:
>> The place to put the answer
>>
>> https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-i-use-a-third-party-javascript-library-in-an-amber-project
>>
>> (fixed spelling error)
>>
>> On 4/11/15, H. Hirzel <[hidden email]> wrote:
>>> **Update:**
>>>
>>> The question you are asking seems to be
>>>
>>> "How do I use a third-party JavaScript library in an Amber".
>>>
>>> This is a question which needs to be answered in the FAQ
>>> http://docs.amber-lang.net/faq.html
>>> Currently it is not.
>>>
>>>
>>> Answers so far
>>>
>>> On the wiki FAQ there are three answers which answer part of it or
>>> help with problems when importing third party libraries.
>>>
>>> https://github.com/amber-smalltalk/amber/wiki/FAQ#i-am-integrating-a-javascript-library-and-i-need-to-add-its-amdjson-file-what-should-i-use-as-path-there
>>>
>>> https://github.com/amber-smalltalk/amber/wiki/FAQ#why-should-i-not-refer-to-min-files-in-amdjson-files
>>>
>>> https://github.com/amber-smalltalk/amber/wiki/FAQ#my-imports-is-invalid-and-my-app-fails-to-load-so-i-cannot-get-to-ide-how-to-recover
>>>
>>>
>>> Here is a draft of a HowTo
>>> https://trello.com/c/gbecTh6f/19-integrate-a-javascript-library
>>>
>>> And a complete example together with the description how it was done
>>>
>>> https://github.com/hhzl/Amber-snapsvg-demo
>>>
>>> I opened an issue for this
>>>
>>>      https://github.com/amber-smalltalk/amber-documentation/issues/55
>>>
>>> @Everybody, please help to develop the answer on the wiki in the
>>> upcoming
>>> days.
>>>
>>> here
>>> https://github.com/amber-smalltalk/amber/wiki/FAQ#how-do-a-use-a-third-party-javascript-library-in-an-amber-project
>>>
>>> As the information is laying around at different places. It just needs
>>> to be put together.
>>>
>>> Afterwards we will move the finalized answer to the more prominent
>>> place at  http://docs.amber-lang.net/faq.html
>>>
>>>
>>> --Hannes
>>>
>>>
>>>
>>> On 4/10/15, H. Hirzel <[hidden email]> wrote:
>>>> Vicnet
>>>>
>>>> As Herby notes you need to construct a file
>>>>
>>>>    papaparse.amd.json
>>>>
>>>> (Note: not papaparser.amd.json; your bower command uses a wrong name).
>>>>
>>>> More on this here
>>>>
>>>> http://stackoverflow.com/questions/27374889/how-to-add-a-non-amber-library-with-bower-for-example-processing-js
>>>>
>>>> HTH
>>>>
>>>> --Hannes
>>>>
>>>> BTW which is the repo you are working with?
>>>>
>>>> On 4/10/15, Herby Vojčík <[hidden email]> wrote:
>>>>>
>>>>>
>>>>> H. Hirzel wrote:
>>>>>> I thought there is a draft for a how for this?
>>>>>
>>>>> I don't know, sorry. Not to mention I am that much forward that I
>>>>> can't
>>>>> even imagine what real users out there struggle with when trying to
>>>>> catch up from pre-0.13 (or even older) codebases. For me, 0.13 is
>>>>> already antiquity.
>>>>>
>>>>> I hope you have better overview, after Sebastian disappeared from the
>>>>> documentation work, I hope you are now the best candidate for The One
>>>>> Who Knows His Way Around Docs.
>>>>>
>>>>>> On 4/10/15, Herby Vojčík<[hidden email]>  wrote:
>>>>>>>
>>>>>>> Vicnet wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> I try to install papaparser (http://papaparse.com/) with this
>>>>>>>> command:
>>>>>>>> bower install papaparser --save
>>>>>>>> grunt devel
>>>>>>>>
>>>>>>>> The lib is installed in bower_components and in bower.json but not
>>>>>>>> in
>>>>>>>> config.js nor in the.js.
>>>>>>>>
>>>>>>>> So the lib could be imported in my package !
>>>>>>>>
>>>>>>>> What is wrong ?
>>>>>>> You don't have amd paths mapping.
>>>>>>>
>>>>>>> Which you must must put in<project root>/papaparser.amd.json (in
>>>>>>> case
>>>>>>> the
>>>>>>> directory under bower_components is called papaparser).
>>>>>>>
>>>>>>>> a+
>>>>>>>> Vicnet
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups
>>>>>>> "amber-lang" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send
>>>>>>> an
>>>>>>> email to [hidden email].
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups
>>>>> "amber-lang" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an
>>>>> email to [hidden email].
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>
>>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Herby Vojčík


Dňa 13. apríla 2015 17:21:54 CEST používateľ "H. Hirzel" <[hidden email]> napísal:
> Added a note
>
> There seems to be a distinction between
>
> - Third party JavaScript libraries which are registered in bower.io
> and those which are not.

From the point of view of Amber infrastructure (.amd.json files, grunt devel generating config.is) there no distinction whatsoever.

From the PoV of easy dependency management, there is, as latter means you must care of those things by hand, but that is not what you meant, I presume.

> - And then there is a distinction if the external library is an AMD
> module or not.

From the point of view of path mappings, there is no distinction whatsoever.

From the PoV of AMD loading process itself, there is a distinction, but that is generic, not Amber-specific. For legacy modules, you must shim dependencies so module is loaded after its dependencies; and you must shim exports, so loader knows when the module itself is loaded, in case it is a dependence of another module (which it always is, at least the artificial one specified in deploy.js or devel.js).

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Hannes Hirzel
Thank you for the clarifying details. I think the next thing is to put
this information into table form and in particular have a column which
indicates what the user (i.e. developer) has to do.

Here is a first draft of table with the cells partially filled out

Registered       AMD                    Source of                      User
in bower.io       module                 Mapping  info
activity         Remarks
---------------       ---------------
---------------------------         ----------
----------------------
yes                 yes                       amd.json in lib. dir         none

no                  yes                       ./.

yes                 no                        libdir.amd.json in
     manual creation of
                                                 project root
          libdir.json

no                  no

On 4/13/15, Herby Vojčík <[hidden email]> wrote:

>
>
> Dňa 13. apríla 2015 17:21:54 CEST používateľ "H. Hirzel"
> <[hidden email]> napísal:
>> Added a note
>>
>> There seems to be a distinction between
>>
>> - Third party JavaScript libraries which are registered in bower.io
>> and those which are not.
>
> From the point of view of Amber infrastructure (.amd.json files, grunt devel
> generating config.is) there no distinction whatsoever.
>
> From the PoV of easy dependency management, there is, as latter means you
> must care of those things by hand, but that is not what you meant, I
> presume.
>
>> - And then there is a distinction if the external library is an AMD
>> module or not.
>
> From the point of view of path mappings, there is no distinction
> whatsoever.
>
> From the PoV of AMD loading process itself, there is a distinction, but that
> is generic, not Amber-specific. For legacy modules, you must shim
> dependencies so module is loaded after its dependencies; and you must shim
> exports, so loader knows when the module itself is loaded, in case it is a
> dependence of another module (which it always is, at least the artificial
> one specified in deploy.js or devel.js).
>
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Tommaso DS
I have a question:

I included a javascript library (d3js in this case) following the documentation in this thread (using d3.amd.local and imports: {"d3"}), and it worked perfectly.
I usually like to not version the .js generated files, to not clutter the versioning system. As a result, I recompile the whole project by running "grunt".

However, when I recompile the project in this way, if the smalltalk code references the imported variables (I imported the library as "d3") I get an error saying that the variable is not defined.
Is there a way to specify the dependency of the library in the Grunfile?

Thanks!

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Hannes Hirzel
Hello Tommaso

Is the question with d3js still an issue or did you resolve it in the meantime?

If not could you please construct a sample project like

     https://github.com/hhzl/Amber-snapsvg-demo

so that we can have a look at the issue?

--Hannes

On 4/22/15, [hidden email] <[hidden email]> wrote:

> I have a question:
>
> I included a javascript library (d3js in this case) following the
> documentation in this thread (using d3.amd.local and imports: {"d3"}), and
> it worked perfectly.
> I usually like to not version the .js generated files, to not clutter the
> versioning system. As a result, I recompile the whole project by running
> "grunt".
>
> However, when I recompile the project in this way, if the smalltalk code
> references the imported variables (I imported the library as "d3") I get an
>
> error saying that the variable is not defined.
> Is there a way to specify the dependency of the library in the Grunfile?
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Tommaso DS


Il giorno mercoledì 29 aprile 2015 16:19:42 UTC+2, Hannes ha scritto:
Hello Tommaso

Is the question with d3js still an issue or did you resolve it in the meantime?

Well, it is not strictly related to d3js, my problem is that when I use grunt with the default task (amberc:all) to recompile the sources it seems to ignore the imports defined in the package definition, thus causing a compilation error.

I don't know if I am missing something, but tomorrow I can construct an example showing the issue.
Thanks for your attention.

Tommaso

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Herby Vojčík


[hidden email] wrote:
>
>
> Il giorno mercoledì 29 aprile 2015 16:19:42 UTC+2, Hannes ha scritto:
>
>     Hello Tommaso
>
>     Is the question with d3js still an issue or did you resolve it in
>     the meantime?

Ah. Now I see.

Yes, imports are ignored for good reason - they can contain external browser libraries which are of course not loadable while compling from cli.

To make amberc load other amber libs (doesn't matter if they are implicit or explicit dependencies), you must pass them in list of libraries and give it path where to look for them (-l and -L in amberc cli, some options like maybe libraries and library_dirs, don't remember exactly, in grunt).

And of course, all .st files as well as all the libraries must be specified in dependency order.

Grunt compilation is not exactly user friendly. In fact, don't use it unless you really need. You can do nearly everything nicely from IDE itself.

>
>
> Well, it is not strictly related to d3js, my proble
m is that when I

> use grunt with the default task (amberc:all) to recompile the sources
> it seems to ignore the imports defined in the package definition, thus
> causing a compilation error.
>
> I don't know if I am missing something, but tomorrow I can construct
> an example showing the issue.
> Thanks for your attention.
>
> Tommaso
>
> --
> You received this message because you are subscribed to the Google
> Groups "amber-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [hidden email]
> <mailto:[hidden email]>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Using a third party JavaScript library in Amber (Re: [amber-lang] Bower install javascript lib but not include in config.js)

Herby Vojčík
Not to mention - imports are totally orthogonal to the fact of compiling
.st into .js. You never need to put package into imports if you subclass
or extend it - in that case, it is implicit dependency that Amber itself
knows about. But not amberc - there you need to list all such
dependencies except the kernel, which is present by default.

IOW it's nothing with imports - it's with not listing all the needed
libraries for amberc task - your code must depend on some other package
except kernel, which you must explicitly mention along with places to
look for it.

Herby Vojčík wrote:

>
>
> [hidden email] wrote:
>>
>>
>> Il giorno mercoledì 29 aprile 2015 16:19:42 UTC+2, Hannes ha scritto:
>>
>> Hello Tommaso
>>
>> Is the question with d3js still an issue or did you resolve it in
>> the meantime?
>
> Ah. Now I see.
>
> Yes, imports are ignored for good reason - they can contain external
> browser libraries which are of course not loadable while compling from cli.
>
> To make amberc load other amber libs (doesn't matter if they are
> implicit or explicit dependencies), you must pass them in list of
> libraries and give it path where to look for them (-l and -L in amberc
> cli, some options like maybe libraries and library_dirs, don't remember
> exactly, in grunt).
>
> And of course, all .st files as well as all the libraries must be
> specified in dependency order.
>
> Grunt compilation is not exactly user friendly. In fact, don't use it
> unless you really need. You can do nearly everything nicely from IDE
> itself.
>
>>
>>
>> Well, it is not strictly related to d3js, my proble
> m is that when I
>> use grunt with the default task (amberc:all) to recompile the sources
>> it seems to ignore the imports defined in the package definition, thus
>> causing a compilation error.
>>
>> I don't know if I am missing something, but tomorrow I can construct
>> an example showing the issue.
>> Thanks for your attention.
>>
>> Tommaso
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "amber-lang" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an email to [hidden email]
>> <mailto:[hidden email]>.
>> For more options, visit https://groups.google.com/d/optout.
>

--
You received this message because you are subscribed to the Google Groups "amber-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.