Closed jaydson closed 9 years ago
:+1:
Hi!
I'm using Harmonic to generate a small site and here's a question: there's a way to add a new theme without to publish a npm package? Let's say that I don't think the theme is useful enough to be published or something like that. Maybe something on command line/configuration file to point to a path where the theme is. If you think this is useful I would like to work on this "feature" :smile:
Hey! Thanks for the feedback.
Currently, you can develop a theme package locally and npm link
it to your Harmonic site directory—this makes a symlink at node_modules/harmonic-theme-myOwnTheme
pointing to your local theme. Or, you can even develop the theme directly inside your Harmonic site directory's node_modules/harmonic-theme-myOwnTheme
directory.
That said, there's still a lot to improve regarding theme development. I'm thinking about adding a command to create a new theme package skeleton, and we also need to get the live-reload to detect file changes inside the active theme, for instance.
As for local themes, perhaps we can use the same rules as Node.js's require()
function? That is, if the harmonic.json
's theme path begins with ./
or ../
it is considered a local path, otherwise it looks into the installed packages (node_modules
). I believe we can leverage the require.resolve
function to implement this feature without reimplementing the whole module lookup logic.
This PR Introduces Harmonic themes