Using 3rd party js css in v3 #4105
-
Hi there! I'm really new to apostrophe so please bear with me! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
The simplest way is to use ui/src folders in any module, see:
https://v3.docs.apostrophecms.org/guide/front-end-assets.html#placing-client-side-code
For specifics on the correct way to import your custom styles and
javascript.
…On Wed, Mar 22, 2023 at 6:32 PM Chris Chan ***@***.***> wrote:
Hi there!
I'm really new to apostrophe so please bear with me!
I've seen multiple answers on pushing assets in v2 to get things like
bootstrap or font-awesome in, but in v3, I'm not seeing how to easily add
that into my pages? Could someone please provide some advice?
Thanks!
—
Reply to this email directly, view it on GitHub
<#4105>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27P4LKF6VUNIN3PKZETW5N4ZRANCNFSM6AAAAAAWEN26RU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
-
The answer depends on what the content type is and what pages need it. For a Google Analytics script, I would put it into an |
Beta Was this translation helpful? Give feedback.
-
Interesting Bob, are you talking about the @analytics/google-analytics npm
module? BTW that seems to be unofficial, as in not from Google, although it
seems to be from a good source. The traditional paste-of-tags-from-google
in an extraHead tag is an official google offering.
…On Thu, Mar 23, 2023 at 8:24 AM Robert Means ***@***.***> wrote:
The answer depends on what the content type is and what pages need it. For
a Google Analytics script, I would put it into an extraHead block
<https://v3.docs.apostrophecms.org/guide/layout-template.html>. You can
do that in the main views/layout.html file, or in specific page
templates. If your package is available as an npm package, like Google
Analytics, you could also elect to install it in your project and then
import it through an index.js file within a module's ui/src folder. This
is going to make that code generally available throughout the project. For
stylesheets, you can import from a local npm package or from a URL using
@import within the index.scss file within a module's ui/src folder. Hope
this helps.
—
Reply to this email directly, view it on GitHub
<#4105 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAH27NSDLHXHHFGN6MFXPTW5Q6JDANCNFSM6AAAAAAWEN26RU>
.
You are receiving this because you commented.Message ID:
***@***.***
com>
--
THOMAS BOUTELL | CHIEF TECHNOLOGY OFFICER
APOSTROPHECMS | apostrophecms.com | he/him/his
|
Beta Was this translation helpful? Give feedback.
The answer depends on what the content type is and what pages need it. For a Google Analytics script, I would put it into an
extraHead
block. You can do that in the mainviews/layout.html
file, or in specific page templates. If your package is available as an npm package, like Google Analytics, you could also elect to install it in your project and then import it through anindex.js
file within a module'sui/src
folder. This is going to make that code generally available throughout the project. For stylesheets, you can import from a local npm package or from a URL using@import
within theindex.scss
file within a module'sui/src
folder. Hope this helps.