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

fis3-preprocessor-vue-tmpl

v1.0.12

Published

vue2.0 template compiler for fis3 and es2015 supported as well.

Downloads

25

Readme

fis3-preprocessor-vue-tmpl

Note: 仅支持在fis3中使用,不支持`.vue`形式的单文件

功能说明

fis3-preprocessor-vue-tmpl是一款用于在fis3构建时对vue2.0的模板进行编译的插件,支持的特性包括:

  • commonjs方式引用js模块
  • babel解析ES2015语法
  • 直接引用npm模块
  • 构建时预编译vue2.0的模板为Render函数
  • 保持对fis3内置语法(__inline/__uri())的支持

特性描述

由于vue2.0支持独立构建与运行时构建,因此采用Runtime-only build可以减少运行时的代码体积。

然而,使用这种方式并不支持template属性,仅能对单文件中的模板进行编译,或者就是直接写渲染函数。当项目较为大型时,单文件的书写方式可能导致一个文件中的代码量较多,三种资源混杂在一起可能并不是太方便管理,而直接写渲染函数又并不是太直观。

当我们使用fis3时,会直接在xxx.html中写模板,并使用template: __inline('xxx.html')这样的方式来引用模板,从而让代码量较多的组件可以合理地组织三种资源(html/css/js)。与直接写渲染函数相比,贴近HTML的模板语法,可读性更友好一些。

从渲染的过程来看,无论template属性中引用的模板代码,抑或是单文件(.vue)中的模板最终都会被vue的编译器编译为Render函数,再渲染为virtual dom,我们因此可以将模板编译的过程提前到构建阶段,这样就可以减少运行时编译所产生的耗时。

这个插件本质上是将fis3的__inline()语法替换为Vue.compile,既保持开发时贴近HTML的模板语法,又在构建时就完成了模板的编译。

安装

局部安装

npm install fis3-preprocessor-vue-tmpl --save-dev

全局安装

npm install fis3-preprocessor-vue-tmpl -g

使用

//fis-conf.js

fis.match('main.js', {
    preprocessor: fis.plugin('vue-tmpl', {
        browserify: {
            debug: true
        },
        es2015: {
            enable: true,
            presets: ['es2015', 'stage-2']
        }        
    })
});
  • 其中browserify中的配置与browserify opts保持一致。
  • 若要启用es2015支持,需要将es2015选项中的enaable属性配置为truepresets属性才会生效。