定制 dev-lucid/html 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dev-lucid/html

Composer 安装命令:

composer require dev-lucid/html

包简介

A library for building HTML.

README 文档

README

A library for building HTML.

Basic Usage

# in Javascript!
var factory = new lucid.html.factory();
var myAnchor = factory.build('anchor', 'http://google.com', 'google');
console.log(myAnchor.render());
# in PHP!
# (this assumes you've configured an autoloader to find this class)
$factory = new \Lucid\Html\Factory();
$myAnchor = $factory->build('anchor', 'http://google.com', 'google');
echo($myAnchor->render());

Both of these code samples will log/echo this:

<a href="http://google.com">google</a>

Building and Testing

Building all tags and running tests

There's one main script that does pretty much everything you'll need to do to change the source, package it up, and test it:

bin/make

This does the following:

  1. Builds all tags (See sections below)
  2. Packages up all Javascript files (See sections below)
  3. Loads the final javascript files in node just to do one final syntax check
  4. Runs all unit tests

This library uses phpunit to run unit tests, but additionally runs javascript tests through phpunit by calling node.js through shell_exec. So in order to run unit tests, you must install node. You will also have to use composer before running tests as the tests use composer's autoloader.

Building Tags

Every tag in the library is generated using a json file that describes the tag. To generate the javascript tag for the base anchor tag,

bin/makeTagJavascript.php ./src/Base/meta/anchor.json
 # This will generate ./src/Base/tags/anchor.js

To generate the PHP tag for the base anchor tag,

bin/makeTagPHP.php ./src/Base/meta/anchor.json
 # This will generate ./src/Base/tags/anchor.php

To build all tags in a meta folder:

bin/makeAllTags ./src/Base/meta
 # this builds everything!

Packing up Javascript files for distribution

bin/makeJsDist.php

This will generate four files:

  1. ./dist/lucid.html.buildBaseTagsOnly.js
  2. ./dist/lucid.html.buildBaseTagsOnly.min.js (this is the same as the previous file, but minified)
  3. ./dist/lucid.html.buildBootstrap.js
  4. ./dist/lucid.html.buildBootstrap.min.js (this is the same as the previous file, but minified)

In a project, only one of those 4 files needs to be included.

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固