tutorial on importing and using npm code? #4
Unanswered
pleasantone
asked this question in
Q&A
Replies: 2 comments
-
Will do if I find sometime. Here are some hints may help you getting forward.
$ tree node_modules/foo
scss/
index.scss
js/
index.js import a JS.assets/modules/____/js/index.ts
import "foo/js/index"; import a SASS.assets/modules/____/scss/index.scss
@import "../../../foo/scss/index"; The path is relative to the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Oh simple!!! Thanks!
…On Jan 25, 2024 at 9:15 PM -0600, Razon Yang ***@***.***>, wrote:
Will do if I find sometime. Here are some hints may help you getting forward.
1. npm install -D --save PACKAGE_NAME to install packages.
2. Check the files of package, e.g. tree node_modules/foo, let's say it look like:
$ tree node_modules/foo
scss/
index.scss
js/
index.js
import a JS.
assets/modules/____/js/index.ts
import "foo/js/index";
import a SASS.
assets/modules/____/scss/index.scss
@import "../../../foo/scss/index";
The path is relative to the assets, Hugo will resolve it from node_modules if not found in assets.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Just curious if there is a good tutorial on importing and using npm based js and css in my hbstack based site. Apologies in advance if this is more relevant to hbstack but I thought it general.
or GitHub hosted js/scss code…
looks like an index.ts in assets/modules/____/js/index.ts
but not sure where the npm code goes..?
in any case, a tutorial for dummies as a blog article would be nice…
Beta Was this translation helpful? Give feedback.
All reactions