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

@alotool/bl-pack

v0.0.1

Published

A tool for develop Blogger theme.

Downloads

2

Readme

BL-PACK

A tool for develop Blogger theme.

Getting started

Features

  • Nunjucks
  • Sass and ES6+
  • CSS and JS linter
  • CSS and JS minification
  • and more

Usage

Use starter themes for quick start.

Main folder structure

.
├── dist/ (g)
|   └── theme.xml <---------------------------+
├── src/                                      |
|   ├── js/                                   |
|   |   ├── dist/ (g)                         |
|   |   |   └── script.js <-------+           |
|   |   ├── js-in-template/ (g)   |           |
|   |   └── index.js >------------^           |
|   ├── sass/                                 |
|   |   ├── dist/ (g)                         |
|   |   |   └── style.css <-----------+       |
|   |   ├── sass-in-template/ (g)     |       |
|   |   └── index.scss >--------------^       |
|   ├── skin/                                 |
|   |   ├── dist/ (g)                         |
|   |   |   └── style.css <---------------+   |  # (<-) = Compiled
|   |   ├── skin-in-template/ (g)         |   |  # (>-) = Source
|   |   └── index.css >-------------------^   |  # (c)  = Config file
|   └── index.xml >---------------------------^  # (g)  = Auto-generated
├── .browserslistrc   (c)
├── .eslintrc.json    (c)
├── .stylelintrc.json (c)
├── banner.txt        (c)
├── data.json         (c)
└── package.json      (c)

Index files

  • Template: src/index.xml
  • Sass: src/sass/index.scss
  • Skin: src/skin/index.css
  • JS: src/js/index.js

Config files

.browserslistrc

The config to share target browsers. Learn more about Browserslist.

.eslintrc.json

The default config is recommended, but if you want to change the config you can read the ESLint docs.

.stylelintrc.json

The default config is recommended, but if you want to change the config you can read the Stylelint docs.

banner.txt

The header for compiled Sass, Skin and JS. You can access data from data.json using <%= data.keyName %>, you can also access data from package.json using <%= pkg.keyName %>.

data.json

Store your theme config in this file. This is Nunjucks template context, which means it can be accessed in template using {{ data.keyName }}. Learn more.

package.json

Use this file to manage and install bl-pack and other packages. You also will need to add bl-pack commands and tasks.

bl-pack commands

Define bl-pack commands and tasks to build and develop bl-pack theme.

The commands and tasks are defined in the scripts property of package.json.

Basic example

package.json

{
  "scripts": {
    "start": "bl-pack --mode production --watch",
    "build": "bl-pack --mode production"
  }
}

You’ll be able to run:

  • npm start - Watches the source files and automatically building them whenever you save.
  • npm run build - Build the theme.

Available flags

| Flag | Description | | ---- | ----------- | | --mode | production or development (no minification) | | --no-sass | Exclude Sass from compilation. | | --no-sass-lint | Disable Sass linter. | | --no-skin | Exclude Skin from compilation. | | --no-skin-lint | Disable Skin linter. | | --no-js | Exclude JS from compilation. | | --no-js-lint | Disable JS linter. | | --watch | Watches the source files and automatically building them whenever you save. | | --gulpfile | Custom gulpfile. | | --cwd | Custom CWD. |

Concepts

Template

We uses Nunjucks for its template engine. File extension for template files is .xml.

Source

  • Index file: src/index.xml
  • Compiled to: dist/theme.xml

Paths

  • ./example.xml - Relative to file's directory.
  • ../example.xml - Relative to file's parent directory.
  • example.xml - Relative to the index.xml directory.

<bp:template> tag

Wrap the markup with <bp:template> tag in .xml files.

<bp:template>
  <p>example</p>
</bp:template>

Note: The <bp:template> tag is always required.

template tag

Do not use the default Nunjucks {% include %} tag, use {% template %} tag instead.

src/example-dir/example.xml:

<bp:template>
  <div>
    <p>example</p>
  </div>
</bp:template>

src/index.xml:

<bp:template>
  <div>
    {% template "./example-dir/example.xml" %}
  </div>
</bp:template>

Output:

<div>
  <div>
    <p>example</p>
  </div>
</div>
Including template from node modules

You can also include template from node modules:

<bp:template>
  {% template "package-name/path/to/file.xml" %}
</bp:template>

Learn how to create plugin for bl-pack by reading this section below.

asset tag

Use {% asset %} tag to include compiled Sass, Skin, JS, and other CSS and JS assets.

Note: You must use the {% asset %} tag to prevent assets from being prettied.

Usage example

{% asset %}
  <style>
  .element {
    display: block;
  }
  </style>
{% endasset %}

With files:

{% asset %}
  <style>
  {% asset "./path/to/file1.css" %}
  {% asset "./path/to/file2.css" %}
  </style>
{% endasset %}

Examples

Normal CSS:

{% asset %}
  <b:if cond='!data:view.isLayoutMode'>
  <style>
  {% asset "./sass/dist/style.css" %}
  </style>
  </b:if>
{% endasset %}

Skin CSS:

{% asset %}
  <b:if cond='!data:view.isLayoutMode'>
  <b:skin>
  <![CDATA[
  {% asset "./skin/dist/style.css" %}
  ]]>
  </b:skin>
  </b:if>
{% endasset %}

Layout Mode CSS:

{% asset %}
  <b:if cond='data:view.isLayoutMode'>
  <b:template-skin>
  <![CDATA[
  body#layout {}
  ]]>
  </b:template-skin>
  </b:if>
{% endasset %}

JS:

{% asset %}
  <script>
  //<![CDATA[
  {% asset "./js/dist/script.js" %}
  //]]>
  </script>
{% endasset %}

Including assets from node modules

You can also include assets from node modules:

{% asset %}
  <b:if cond='!data:view.isLayoutMode'>
  <style>
  {% asset "package-name/path/to/file.css" %}
  </style>
  </b:if>
{% endasset %}

extends tag

Use Nunjucks {% extends %} tag. See Nunjucks template inheritance.

src/base.xml:

<bp:template>
  <header>
    {% block header %}{% endblock %}
  </header>

  <main>
    {% block main %}{% endblock %}
  </main>

  <footer>
    {% block footer %}{% endblock %}
  </footer>
</bp:template>

src/index.xml:

<bp:template>
  {% extends "./base.xml" %}

  {% block header %}
  This is header content.
  {% endblock %}

  {% block main %}
  This is main content.
  {% endblock %}

  {% block footer %}
  This is footer content.
  {% endblock %}
</bp:template>

Output:

<header>
  This is header content.
</header>

<main>
  This is main content.
</main>

<footer>
  This is footer content.
</footer>

Variables

You can use variables from data.json using {{ data.keyName }} and you can also use variables from package.json using {{ pkg.keyName }}.

Example

data.json:

{
  "myVar": "Value of myVar"
}

package.json:

{
  "name": "my-awesome-theme"
}

file.xml:

<bp:template>
  <p>{{ data.myVar }}</p>
  <p>{{ pkg.name }}</p>
</bp:template>

Output:

<p>Value of myVar</p>
<p>my-awesome-theme</p>