nckrtl
August 13, 2017, 10:33am
1
Hi,
I’m pretty new to sage and and i’m trying to include a node_module I installed via npm install. Now i want the node_module to be included in my project but I have no idea how to do that. I assume i have to add something to webpack in order to bundle the js of the given module with the rest of the files.
I read the documentation but this isn’t covered anywhere afaik or I missed it.
So my question is: How do you include/use a node_module in your project.
Thanks,
Nick
Log1x
August 13, 2017, 12:18pm
2
The latest docs are in the Sage 9 branch.
---
ID: 5322
post_title: Theme Development and Building
author: Ben Word
post_date: 2015-09-01 18:19:21
post_excerpt: ""
layout: doc
permalink: >
https://roots.io/sage/docs/theme-development-and-building/
published: true
---
<p class="lead">These are the primary projects that make up the Sage workflow:</p>
<ul class="lead">
<li><h4><a href="https://webpack.github.io/">Webpack</a></h4><p><small>is used as a build tool for compiling stylesheets, checking for JavaScript errors, optimizing images, and concatenating and minifying files. In previous versions of the theme we used Grunt and Gulp as our build tools.</small></p></li>
<li><h4><a href="https://www.npmjs.com/">npm</a></h4><p><small>npm is a front-end package manager. Sage uses npm to pull in Bootstrap and jQuery as dependencies. In previous versions of the theme we used Bower as our front-end package manager.</small></p></li>
<li><h4><a href="http://www.browsersync.io">BrowserSync</a> with Webpack Hot Module Replacement</h4><p><small>BrowserSync with WHR keeps multiple browsers and devices synchronized while developing, along with injecting updated CSS and JS. In previous versions of the theme we used LiveReload for injecting assets.</small></p></li>
</ul>
<div class="cta-product cta-product-sage well well-sage module"><a href="https://roots.io/books/theme-development-with-sage/" class="media"><div class="media-left"><img class="media-object" src="/app/uploads/theme-development-with-sage-cover-800x1035.png" alt="Sage book cover"></div><div class="media-body"><h4><span class="badge bg-white text-sage">Get the book</span> <br> <span class="text-sage">Theme Development with Sage</span></h4><p class="lead">A step-by-step guide to setting up a custom Sage starter theme.</p><p class="visible-md visible-lg">Build well organized & easily maintained WordPress themes using a modern web development workflow.</p><p class="text-right"><button class="btn btn-primary">Buy</button></p></div></a></div>
This file has been truncated. show original
1 Like
nckrtl
August 13, 2017, 1:13pm
3
Thanks for the hint, I got it working!