<!-- Place this tag in your head or just before your close body tag. -->
<divclass="plugin">
<divclass="row">
<divclass="col-sm-12">
<h1>Plugin – lektor-npm-support 0.1.4</h1>
</div>
</div>
<divclass="row">
<divclass="col-sm-1"></div>
<divclass="col-sm-11">
<p>Adds support for using npm/yarn to build assets in Lektor using tools such as <ahref="https://parceljs.org/"class="ext">Parcel</a>, <ahref="https://webpack.js.org/"class="ext">webpack</a>, etc.<p>
<li><p><aclass="github-button"href="http://github.com/sterin/lektor-npm-support"data-icon="octicon-star"data-size="large"data-show-count="true"aria-label="Star lektor-npm-support on GitHub"target="_blank">Star</a></p></li>
<p><code>lektor-npm-support</code> makes it easy to use <ahref="https://parcel.js.org"rel="nofollow">Parcel</a>, <ahref="https://webpack.js.org"rel="nofollow">webpack</a>, <ahref="http://browserify.org/"rel="nofollow">browserify</a>, or any other tool to build assets for <ahref="https://github.com/lektor/lektor"rel="nofollow">Lektor</a> projects.</p>
<h2>Enabling the Plugin</h2>
<p>To enable the plugin, run this command while inside your Lektor project directory:</p>
<li>The section name <code>[parcel]</code> is the name of the folder where the Parcel project is located.</li>
<li><code>npm</code> is the package manager command used to build the project. This example will use <ahref="https://yarnpkg.com"rel="nofollow">Yarn</a>.</li>
<li><code>watch_script</code> is the npm script used in <code>lektor server -f npm</code>,</li>
<li><code>build_script</code> is the npm script used in <code>lektor build -f npm</code>.</li>
</ul>
<p>This plugin supports more than one such entry.</p>
<h3><code>parcel/package.json</code></h3>
<p>This is a standard <code>package.json</code> file. It should contain two entries in the <code>scripts</code> section. The <code>build</code> script is used during <code>lektor build -f npm</code>, and the <code>watch</code> script is used during <code>lektor server -f npm</code>.</p>
<p>Now we can use <code>yarn add</code> to add Parcel, <ahref="https://babeljs.io/"rel="nofollow">Babel</a> and <ahref="https://sass-lang.com/"rel="nofollow">Sass</a>:</p>
<pre><code>$ cd </path/to/your/lektor/project>/parcel
<p>The <code>examples</code> folder of this repository contains working projects.</p>
<h2>Credits</h2>
<p>This plugin is based on the official <ahref="https://github.com/lektor/lektor-webpack-support"rel="nofollow">lektor-webpack-support</a> Lektor plugin by <ahref="http://lucumr.pocoo.org/about/"rel="nofollow">Armin Ronacher</a>.</p>
Please enable JavaScript to view the <ahref="https://disqus.com/?ref_noscript"
rel="nofollow">comments powered by Disqus.</a>
</noscript>
</div>
</div>
</div>
</div>
</div>
</div>
<divclass="bottomsummary">
<divclass="container">
</div>
</div>
<footer>
<divclass="container">
<divclass="row">
<divclass="col-sm-4 icon-bar">
<ahref="https://github.com/lektor/lektor/"title="Lektor on GitHub"
><iclass="fa fa-github"></i></a>
<ahref="https://github.com/lektor/lektor/issues/"title="Report Issues for Lektor"
><iclass="fa fa-bug"></i></a>
<ahref="https://twitter.com/getlektor"title="Find Lektor on Twitter"
><iclass="fa fa-twitter"></i></a>
<ahref="https://gitter.im/lektor/lektor"title="Chat on Gitter"
><iclass="fa fa-comment"></i></a>
<ahref="https://github.com/lektor/lektor-website/tree/master/content/plugins/lektor-npm-support/contents.lr"title="View source for this page"><iclass="fa fa-code"></i></a>
</div>
<divclass="col-sm-8">
<ahref="../../license/">License & Copyright</a> •
<ahref="../../contact/">Contact</a> •
Made with <iclass="fa fa-fw fa-heart"title="Heart"><spanhidden>Heart</span></i> in Carinthia