Giter Site home page Giter Site logo

fis-parser-velocity's People

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

peterpan-1989

fis-parser-velocity's Issues

plugin的loader设置为"require"无法加载js

如果将loader设置为"require",页面加载js部分的代码为

require(["/widget/header/header.js", "widget/footer/footer.js"]);

在源码中,可以修改成如下

if(loader) {
    arrJs.push(jsFile.substring(1, jsFile.lastIndexOf('.')));
} else {
    arrJs.push('<script src="' + jsFile + '"></script>\n');
}

最后页面加载js部分的代码为

require(["widget/header/header", "widget/footer/footer"]);

另外如果采用前端打包方式,即fis3-postpackager-loader,即使将插件的allInOne属性设置为true,依然无法将组件的js打包成一个文件,还需要在page下的html文件中声明依赖:

<!--
    @require widget/header/header.js
    @require widget/footer/footer.js
 -->

所以建议在添加require([])代码时,添加fis的依赖语法,以方便打包。

最后还有一个建议,模版的context或者称之为mock数据,可以使用js文件代替json,好处是可以模拟velocity tool中的一些方法,如$math.floor(),使之更加灵活。
js文件:

module.exports = {}

加载mock数据

require(mockPath);
delete require.cache[mockPath];

最近我也在写一个fis的解析Velocity模版的插件,看了您的代码,收获很多,非常感谢。

您好,请问有没有详细的说明文档呢?

我们团队最近想用FIS3来构建前端的项目,恰好我们的后端也是在用Velocity。
现在用您的demo,做如下操作:

cd example\pure
fis3 release -d ../output
提示:[ERROR] parser.0: Cannot find module 'velocity' [E:/Software/nginx/html/FIS/fis-parser-velocity/example/pure/page/index.vm]
不知道是什么原因呢?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.