Coder Social home page Coder Social logo

fis-pure-demo's Introduction

基于纯前端解决方案fis-pure的自定义demo

fis-pure-demo 的基础上,自定义了目录结构,方便纯静态页面的搭建。

目录介绍

  • page中存放html文件
  • lib中存放不需要编译的js文件
  • modules中存放js、css,以及模板文件
  • 使用__inline引入页面公共部分

使用方法

  • 安装Node.js环境

  • 安装fis-pure

npm install -g fis-pure
  • 修改完代码后执行 pure release -d ./dist

  • 如果需要本地预览,可以在执行完pure release后,再执行pure server start

  • 编译完后的代码在dist中

以下是fis-pure-demo的文档

fis-pure-demo

安装fis-pure

npm install -g fis-pure

安装成功后执行 pure -h 即可看到相关开发命令帮助

下载demo代码

git clone https://github.com/hefangshi/fis-pure-demo

也可以直接使用右侧的 Download Zip

让代码跑起来!

首先,启动内置的调试服务器:

pure server start

此时fis会启动一个精巧的jetty服务器,并且打开浏览器访问了 http://127.0.0.1:8080 ,现在这个调试环境什么也没有,接下来,我们在命令行下cd到我们下载的样例项目中:

cd fis-pure-demo

第三步,执行fis的编译命令:

pure release

第四步,刷新浏览器,查看我们的项目。

可以看到所有的模块化资源均已自动加载进来了

第五步,优化性能

虽然目前项目可以正常运行,但是这种加载方式会造成连接数过多,让我们调整参数,对资源进行自动合并

pure release -p

再次浏览页面,我们可以发现原有的大量静态资源已经自动合并。

目录规范

任何 目录规范部署规范编译规范 都是可配置的(配置代码),这里只介绍内置的规范。

注意

如果希望调整目录规范,建议将配置代码中roadmap.path的部分整体复制到项目的fis-conf.js中再进行调整,避免配置不符合预期的问题。

内置的规范包括:

  1. 扔在 modules 目录下的js、css、less、coffee文件都是模块化文件,会自动包装define,自己就不要写了。使用require.async或者require加载模块的时候id与文件的对应规则是这样的:
文件 引用id 举个例子
/modules/a.js a require.async('a');
/modules/b/b.js b require.async('b');
/modules/b/c.js b/c require.async('b/c');
1. 扔在 ``lib`` 目录下的文件不被认为是模块化的,请直接在页面上使用script或link标签引用。

fis-pure-demo's People

Contributors

hefangshi avatar liucong1 avatar

Watchers

 avatar

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.