Giter Site home page Giter Site logo

easyweb's Introduction

操作说明

Releases

修改配置文件

编辑 config.json 文件中的配置参数, 如果没有则自行创建

{
  "template": "模板文件目录地址",
  "views": "网页文件目录地址",
  "static": "静态文件目录地址",
  "Port": "服务端口"
}

static

除 html 文件外的资源文件, 比如 css, js 等文件

template 使用教程

配置公共文件, 比如配置统一的头部, 统一的尾部等内容。

目录结构
common
    head.html
layout
    index.html
  • define 定义模板名称
  • template 导入公共文件
{{ define "common/head.html" }}
<title>{{ .title }}</title>
{{ end }}
{{ define "layout/index.html" }}
<!DOCTYPE html>
<html lang="en">
<head>
    {{ template "common/head.html" . }}
</head>
<body>
    {{ .content }}
</body>
</html>
{{ end }}

views

所有 html 文件

案例

html 文件中的第一行为配置信息

  • title 网页标题
  • layout 指定 template 中的模板名称
<!--{ "title": "XXX", "layout": "layout/index.html" }-->
<div>
    <p>hello world</p>
</div>

easyweb's People

Contributors

svonme avatar

Watchers

 avatar  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.