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

rake-parser-vue-component

v1.1.2

Published

parser vue component

Downloads

28

Readme

rake-parser-vue-component

parser vue component for fisp

FISP parser 阶段插件,用于在fisp rake-zbj中编译Vue组件。

原理

参考vue-loader源码,结合fisp的编译特性而编写,下面是parser阶段的主要过程:

  1. 解析vue文件,找到其中的style,template,script标签。

  2. 每一个style标签创建一个对应的文件,后缀为lang属性指定,默认css,你可以指定less或其它的后缀。创建的文件,一样会进行fisp的编译流程(属性lang的值决定该文件怎么编译),并加入到当前文件的依赖中,编译完成后删除该文件。

  3. template标签的内容为Vue组件的模板,template标签同样有lang属性,默认html(暂时只支持htmljade等模板语言之后加入),会进行html特性处理,模板的内容最终会输出到module.exports.template中。

  4. script标签为文件最后输出的内容,支持lang属性,支持es6语法。

组件编写规范

style标签可以有多个,templatescript标签只能有一个,具体请参考vue 单文件组件

注意

  • 组件中的样式、模板、脚本都会先进行片段处理,会使用对应的parser进行编译处理。
  • 每一个style标签会对应产出一个css文件,与vue组件同目录。
  • script标签内容编译后,为组件的最终产出内容。

安装配置

安装:npm install rake-parser-vue-component --save-dev

配置:

fis.config.set('modules.parser.vue', 'vue-component');
fis.config.set('settings.parser.vue-component', {
    // 组件的配置
});
fis.config.set('roadmap.ext.vue', 'js'); 

css scoped支持

为了保证每一个组件样式的独立性,是当前组件定义的样式只在当前的组件内生效,引入css scoped机制。

  1. 在模板的元素上(一般是根节点)加上scoped标志,默认为'vuec', 你可以通过cssScopedFlag自定义。可以加在class,或者属性,或者id。
<template>
  <div class="test" vuec></div>
</template>
  1. 在样式中使用scoped标志。
.test[vuec] {
  //
}
  1. scoped标志会解析为组件唯一id:vue-component-{index};

  2. 配置:scoped标志默认为'vuec',你可以自定义。

fis.config.set('settings.parser.vue-component', {  
	cssScopedFlag: 'myCssScopedFlag'  
});

测试demo

npm install

cd test, 编写代码…

npm install

rk release

rk server start