• Stars
    star
    117
  • Rank 301,828 (Top 6 %)
  • Language
    JavaScript
  • Created almost 11 years ago
  • Updated almost 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

fis与java-jsp结合使用

展示静态资源管理系统设计思路的demo

环境依赖:

  1. fis
  2. java

运行方法:

注意:一定要先构建,后启动server,因为源码中有server的lib
  1. 进入项目目录
    • cd project
  2. 构建项目
    • 预览开发效果命令: fis release
    • 预览开发效果,并监听文件变化命令: fis release -w
    • 预览开发效果,并监听文件变化,同时自动刷新浏览器命令:fis release -wL
    • 预览文件压缩,加域名,资源合并,csssprite等效果,并监听文件变化,同时自动刷新浏览器命令:fis release -oDpwL
  3. 启动内置服务器
    • fis server start
  4. 刷新页面( http://127.0.0.1:8080/ ),查看效果

目录说明:

  • WEB-INF目录下放fis提供的jsp标签配置及相关jar包文件,包来源看 这里
  • lib目录下放基础库文件,jquery、boostrap等
  • widget目录下放组件化文件
  • fis-conf.js 文件是项目配置
  • index.jsp是入口页面文件

jsp页面示例

代码

<%@ page contentType="text/html;charset=utf-8" %>
<%@ taglib uri="/fis" prefix="fis"%>
<%-- 使用<fis:html>标签替代传统<html>标签,并设置map.json文件部署路径,缺省是“/” --%>
<fis:html mapDir="/map"> 
    <head>
        <meta charset="utf-8"/>
        <title>my jsp page</title>
        
        <%-- 使用<fis:require>替代传统<link href>、<script src>标签来加载静态资源 --%>
        <fis:require id="lib/jquery/jquery-1.10.2.js"/>
        <fis:require id="lib/bootstrap/js/bootstrap.js"/>
        <fis:require id="lib/mod/mod.js"/>
        
        <fis:require id="lib/bootstrap/css/bootstrap.css"/>
        <fis:require id="lib/bootstrap/css/bootstrap-responsive.css"/>
        
        <%-- 使用<fis:styles/>标签显示<fis:require>标签收集到的所有css资源 --%>
        <fis:styles/>
        
    </head>
    <body>
        
        <div class="main">
            <div class="main-header">
                <jsp:include page="widget/header/header.jsp" flush="true"/>
            </div>
            <div class="main-body">
                <jsp:include page="widget/body/body.jsp" flush="true"/>
            </div>
            <div class="main-footer">
                <jsp:include page="widget/footer/footer.jsp" flush="true"/>
            </div>
        </div>
        
        <%-- 在其他widget加载完毕后再加载页面的js、css,效果更好 --%>
        <fis:require id="index.css"/>
        <fis:require id="index.js"/>
        
        <%-- 使用<fis:script>标签代替传统<script>标签,它可以帮你收集页面上的js统一放到尾部 --%>
        <fis:script>
            console.log('1111');
        </fis:script>
        
        <%-- 使用<fis:scripts/>标签显示<fis:require>标签收集到的所有js资源 --%>
        <fis:scripts/>
    </body>
</fis:html>

自定义标签说明

  • 见代码注释

配置说明

fis.config.set('roadmap.path', [
    {
        reg : '**.jsp' //jsp文件不调整部署结构
    },
    {
        reg : 'WEB-INF/**' //WEB-INF目录下的文件不调整部署结构
    },
    {
        reg : 'map.json',   //map.json发布到map目录下
        release : 'map/$&'
    },
    {
        reg : 'widget/**.js',   //widget目录下的js文件
        isMod : true,           //组件化包装
        release : '/static/$&'  //发布到/static/目录下
    },
    {
        reg : 'README.md',
        release : false
    },
    {
        reg : '**',             //其他文件
        release : '/static/$&'  //发布到/static/目录下
    }
]);

//png图片使用pngquant压缩算法,支持将png24压缩为png8,ie6下显示效果较好
fis.config.set('settings.optimizer.png-compressor.type', 'pngquant');

//csssprite布局算法调整,默认是linear,线性布局
//fis.config.set('settings.spriter.csssprites.layout', 'matrix');

//自动define包装
fis.config.set('settings.postprocessor.jswrapper.type', 'amd');

//打包配置
fis.config.set('pack', {
    'pkg/lib.js'  : [
        'lib/jquery/jquery-1.10.2.js',
        'lib/bootstrap/js/bootstrap.js',
        'lib/mod/mod.js'
    ],
    'pkg/lib.css' : [
        'lib/bootstrap/css/bootstrap.css',
        'lib/bootstrap/css/bootstrap-responsive.css'
    ],
    'pkg/widget.js' : 'widget/**.js',
    'pkg/widget.css' : 'widget/**.css'
});

More Repositories

1

blog

没事写写文章,喜欢的话请点star,想订阅点watch,千万别fork!
22,627
star
2

page-monitor

capture webpage and diff the dom change with phantomjs ♨
JavaScript
2,104
star
3

lottery

年会抽奖程序
JavaScript
1,479
star
4

static-resource-digest-project

静态资源摘要信息冗余发布演示项目
JavaScript
453
star
5

pmui

An UI wrapper of page-monitor, to show webpage history captures and diff them.
JavaScript
147
star
6

spmx

a wrapper of fis to build seajs project
JavaScript
132
star
7

static-resource-digest-project-release

static-resource-digest-project项目的md5发布结果展示
CSS
98
star
8

page-diff

a new kernel of page-monitor https://github.com/fouber/page-monitor
JavaScript
75
star
9

static-resource-digest

静态资源摘要信息冗余发布工具,来自知乎问答
JavaScript
66
star
10

static-resource-management-system-demo

展示静态资源管理系统设计思路的demo
PHP
55
star
11

3d-print-queue

给朋友打印的3d玩具排队
52
star
12

spt

简单易用的前端压缩工具
JavaScript
50
star
13

fis-php-md.js

fis与php结合,加一个极小极小的模块化框架
PHP
28
star
14

robot

3d-printed robot with arduino, oled and bluetooth.
Arduino
23
star
15

modjs-todo-demo

modjs todo demo
JavaScript
21
star
16

scrat-pagelet-demo

Demo for scrat seo mode http://scrat-pagelet-demo-fouber.c9.io/
JavaScript
20
star
17

noop

搞一个乱扯淡的blog
Shell
20
star
18

phiz

Pure PHP Template Engine
PHP
20
star
19

goal

A html5 football game
JavaScript
18
star
20

fis-parser-react

a parser plugin for fis to precompile react
JavaScript
17
star
21

story

给宝宝讲故事
JavaScript
16
star
22

fis-java-resource

java版静态资源管理系统样例,以jsp为基础
Java
16
star
23

md.js

a very simple module definition framework, just module definition.
JavaScript
13
star
24

1password

9
star
25

fis-parser-less

A parser for fis to compile less file.
JavaScript
9
star
26

fis-lint-jshint

A lint plugin for fis to validate js file.
JavaScript
8
star
27

fis-parser-handlebars

A parser plugin for fis to precompile handlebars template.
JavaScript
7
star
28

seajs-todo-demo

spmx todo demo
JavaScript
6
star
29

fis-parser-less-2.x

A parser for fis to compile less(v2.x) file.
JavaScript
6
star
30

fis-optimizer-shutup

an optimizer for fis to remove alert,console,console.log, etc.
JavaScript
5
star
31

webapp-demo

a demo of webapp framework
PHP
4
star
32

fis-postpackager-modjs

a postpackager plugin for fis to process map.json and create map.js for modjs
JavaScript
4
star
33

fis-postpackager-seajs

a postpackager plugin for fis to create sea-config.js
JavaScript
3
star
34

fis-preprocessor-image-set

A preprocessor plugin for fis to automatically add -webkit-image-set css rule.
JavaScript
3
star
35

foam-template

CSS
3
star
36

modjs-backbone-demo

fis-modjs-bacekbone
JavaScript
3
star
37

fis-pc

JavaScript
3
star
38

install-php-cgi

install php-cgi
Shell
3
star
39

ci-test

test travis ci
JavaScript
2
star
40

ChooseMe

基于cordova做的小游戏,很无聊,不要看
Java
2
star
41

training

嘻嘻
JavaScript
2
star
42

fis-parser-utc

A parser for fis to compile underscore template.
JavaScript
2
star
43

phiz-demo

a demo of phiz template engine
CSS
2
star
44

GodJob

一个flash版的简易生态环境小游戏
ActionScript
2
star
45

seajs-demo

seajs + fis
JavaScript
1
star
46

dog

a game
JavaScript
1
star
47

performance_test

JavaScript
1
star
48

demo

just demo
1
star
49

fis-parser-bdtmpl

A parser plugin for fis to compile baiduTemplate.
JavaScript
1
star
50

heartbeat

JavaScript
1
star
51

fis-command-watch

a command plugin for fis to watch file or dir changes then execute command
JavaScript
1
star
52

fis-wiki-img

1
star
53

Issue5

a demo for issue #5
JavaScript
1
star
54

fis-postprocessor-phiz-wrapper

a postprocessor plugin for fis to wrapper phiz view file.
JavaScript
1
star