christianalfoni / react-app-boilerplate

React application boilerplate
303 stars 80 forks source link

CDN JS-lib Inclusion? #5

Closed joemccann closed 9 years ago

joemccann commented 9 years ago

Not technically an issue or bug, but am curious as to how I can include a CDN-hosted version of jQuery (or anything for that matter) in the gulp file to include in the <head> the CDN-hosted version of jQuery when I run the deploy gulp configuration?

This is a rock solid boilerplate, btw.

christianalfoni commented 9 years ago

Hi @joemccann!

That is a good question! I searched around a bit and found this one:

https://www.npmjs.com/package/browserify-global-shim

I suppose you could just use that configuration when creating your distributed build. And in your html file just insert jquery CDN at the top manually or using some other build process :-)

did that answer the question?

thanks for the feedback btw!

joemccann commented 9 years ago

yes it does. I just added it to the index.html in the dist directory and all is well. Just wondered if there was a cleaner step than manually adding it.

On Mon, Mar 9, 2015 at 12:18 PM, Christian Alfoni notifications@github.com wrote:

Hi @joemccann https://github.com/joemccann!

That is a good question! I searched around a bit and found this one:

https://www.npmjs.com/package/browserify-global-shim

I suppose you could just use that configuration when creating your distributed build. And in your html file just insert jquery CDN at the top manually or using some other build process :-)

did that answer the question?

thanks for the feedback btw!

— Reply to this email directly or view it on GitHub https://github.com/christianalfoni/react-app-boilerplate/issues/5#issuecomment-77886284 .

christianalfoni commented 9 years ago

I often use the FS module, writeFile, readFile etc. to create custom HTML. Like:

<html>
  <head>
    {{CDN_SCRIPTS}}
  </head>
<body>

</body>

Then I read the file, just use replace to update the placeholders, and then write it again. So I would suggest coding something like that into the workflow. Hope that made sense :-)

joemccann commented 9 years ago

yup nice one thanks

On Mon, Mar 9, 2015 at 12:25 PM, Christian Alfoni notifications@github.com wrote:

I often use the FS module, writeFile, readFile etc. to create custom HTML. Like:

{{CDN_SCRIPTS}} Then I read the file, just use replace to update the placeholders, and then write it again. So I would suggest coding something like that into the workflow. Hope that made sense :-) — Reply to this email directly or view it on GitHub https://github.com/christianalfoni/react-app-boilerplate/issues/5#issuecomment-77887843 .
christianalfoni commented 9 years ago

Cool! good luck :-)