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 🙏

© 2026 – Pkg Stats / Ryan Hefner

fis-preprocessor-layout

v0.0.1

Published

A processor for fis to extends layout template.

Readme

fis-preprocessor-layout

A processor for fis to extends layout template.

When do you need this plugin ?

如果你采用的是实现了模板语法糖扩展的fis解决方案,如fis3-smartyjelloyog2等,你完全用不到这个插件。但是如果你采用的是基于fis的纯前端解决方案或者虽然是后端渲染但是并没有实现相应的模版语法扩展,还想实现类似于PHP Smarty,Python Django以及Jade中模版的继承机制,来实现减少html书写,专注业务逻辑的效果,那么这个插件很可能适合你。

How to use ?

npm install fis-preprocessor-layout --save

fis-conf.js

fis.match('*.html', {
    preprocessor: require('../index')
});

以下面的目录结构为例

.
├── fis-conf.js
├── index
│   ├── index.css
│   ├── index.html
│   └── index.js
└── layout
    ├── layout.css
    ├── layout.html
    └── layout.js

layout.html

<!DOCTYPE html>
<html>
<head>
    <title>
        <!-- block title -->
        <!-- endblock -->
    </title>

    <link rel="stylesheet" href="./layout.css">
    <!-- block head -->
    <!-- endblock -->
</head>
<body>
    <div>Header</div>

    <!-- block body -->
    <!-- endblock -->

    <div>Footer</div>

    <script src="./layout.js"></script>
    <!-- block script -->
    <!-- endblock -->
</body>
</html>

index.html

<!-- extends "../layout/layout.html" -->

<!-- block title -->
     Demo
<!-- endblock -->

<!-- block head -->
    <link rel="stylesheet" href="./index.css" />
<!-- endblock -->

<!-- block body -->
    <div class="content">Hello World!</div>
<!-- endblock -->

<!-- block script -->
    <script src="./index.js"></script>
<!-- endblock -->

released index.html

<!DOCTYPE html>
<html>
<head>
    <title>
        
     Demo

    </title>

    <link rel="stylesheet" href="/layout/layout.css">
    
    <link rel="stylesheet" href="/index/index.css" />

</head>
<body>
    <div>Header</div>

    
    <div class="content">Hello World!</div>


    <div>Footer</div>

    <script src="/layout/layout.js"></script>
    
    <script src="/index/index.js"></script>

</body>
</html>

View Example

git clone https://github.com/vicerwang/fis-preprocessor-layout
cd example
npm install fis3 -g
fis3 server start
fis3 release
open http://127.0.0.1:8080/index/

Note

  • fis-preprocessor-layout采用注释作为block区域的占位符,基本上是不会和你所用模版的语法产生冲突。
  • 编写layout.html时,通过标签的srchref属性引用的资源以相对layout.html的路径书写即可,对于<style>.img { background-img: url(some.png); }</style>或者<div style="background-img:url(some.png);"></div>等情况,请使用绝对路径。