npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lasso-marko-extras

v2.0.2

Published

Lasso and Marko extras

Downloads

3

Readme

lasso-marko-extras

Build static assets and compile Marko templates:

// Configure Lasso before using this module
require('lasso').configure({
  // ... 
});

require('lasso-marko-extras').build({
  baseDir: __dirname,
  files: [
    'layouts/base/favicon.ico'
    'pages/index/image.png'
  ],
  pages: [
    'pages/index',
    'pages/login',
    'pages/terms/pages/about',
    'pages/switcher/pages/faq'
  ]
});

Above script will do the following:

  1. It cleanups ".cache/lasso" and "static" folders

  2. Depending on configuration of Lasso, it builds, minifies, fingerprints and move all static assets to outputDir (Lasso config option) folder using lasso.lassoResource() and lasso.lassoPage().

  3. It recompiles all Marko templates (*.marko) in baseDir folder using markoc compiler.

Enable console output for this module by adding the following lines at the top of the file:

require('raptor-logging').configure({
  loggers: {
    'lasso-marko-extras': 'INFO'
  }
});

This module doesn't introduce dependencies on Lasso or Marko and assumes that your project already depends on them. Check sample project that uses this module: lasso-marko-startkit

Here is the sample output:

INFO lasso-marko-extras/lib/compiler: Output: test/site/layouts/base/template.marko.js
INFO lasso-marko-extras/lib/compiler: Output: test/site/pages/home/template.marko.js
INFO lasso-marko-extras/lib/compiler: Compiled 2 templates(s)
INFO lasso-marko-extras/lib/builder: Folder /Users/dmitry/main/dev/lasso-marko-extras/.cache/lasso removed
INFO lasso-marko-extras/lib/builder: Folder /Users/dmitry/main/dev/lasso-marko-extras/test/site/static removed
INFO lasso-marko-extras/lib/builder: File "layouts/base/favicon.ico" processed.
INFO lasso-marko-extras/lib/builder: Files processed!
INFO lasso-marko-extras/lib/builder: Page "pages/home" processed.
INFO lasso-marko-extras/lib/builder: Build complete!

Page tag

This module also introduces <lasso-page-json /> tag that is a wrapper around <lasso-page /> tag. This tag has no attributes.

The only difference is that <lasso-page-json /> tag reads configuration from page.json file, located in the same folder where template is located. This allows to build static assets with the same configuration options. build() function shown above reads page configuration from page.json file, if available.

In short, if you ever need to specify some attributes on lasso-page tag, specify them in page.json file and use <lasso-page-json /> without attributes.

page.json:

{
  "name": "switcher-faq",
  "cacheKey": "someUniqueKey",
  "flags": ["foo", "bar"]
}

template.marko:

<lasso-page-json />
...