Coder Social home page Coder Social logo

githubhjs / fsbuilder Goto Github PK

View Code? Open in Web Editor NEW

This project forked from falling-sky/fsbuilder

0.0 2.0 0.0 4.66 MB

falling-sky processor that reads templates and translations, outputs compiled publishable content

License: MIT License

Makefile 1.73% Go 95.89% Perl 2.38%

fsbuilder's Introduction

Builder

Go based template compiler for falling-sky

This is being built as a replacement to falling-sky's build.pl, which has a large number of dependencies.

Index

About

This tool will do several things:

  • Read translations/falling-sky.pot for the existing database of translation strings
  • Read translations/dl/*/*.po for translations provided by translators (and downloaded from CrowdIn)
  • Read templates/js for top-level .js files
  • Read templates/css for top-level .css files
  • Read templates/html for top-level .html files
  • Read templates/php for top-level .php files
  • Read templates/apache for top-level .htaccess and .example files
  • Read images/ for .gif .png .jpg and .jpeg files

For outputs, this will create one directory called output/.

  • output/ contains js, css, html, php files, plus some apache files
  • output/images contains images, plus one .htacces file
  • ouputt/images-nc contains the same images, plus a different .htaccess file

Templates

These are the real sources for the falling-sky project; aka test-ipv6.com (and mirror sites).

Thes are processed by Go's template engine. For the template engine we use [% and %] as markers.

These variables are defined:

[% $page %] - Base page name with full text. This is defined inside the .html files specifically, and used by header.inc and navigation includes to selectively enable and disable features/outputs. A typical usage will be to assign the page name at the top - such as: [% $page := "6to4" %].

[% .Baasename %] - Base page name (used in the filename). Example would be simply "index". Defined before template expansion.

[% .GitInfo.Repository %] - Git repo info for the current directory.

[% .GitInfo.Version %] - A synthetic version number based on the latest git tags, and log count. Update the tags to increment the major/minor version numbers.

[% .GitInfo.Date] - UTC time that the last Git commit was made.

[% .DirSignature %] - A signature string that includes the .GitInfo.Version as well as a md5 hash of the most important bits of Apache configuration. The md5 hash will remain constant unless languages are added, or the Apache templates change.

Includes

These directives are also defined, but with strict limitations.

[% PROCESS "filename.inc" %] will replace the [%..%] with the contents of filename.inc. This gives us the ability to have include files; to break things into reusable parts. Some of the web pages, for example, reuse content across various FAQ pages.

Translations

We are doing translations just outside of the template engine. We do this partially for speed (the same template output can be used for all langauges); but also to make it simpler to edit.

Text that is to be translated is simply wrapped around double curly braces, like these examples:

  x = "{{JavaScript text to be translated}}"
<span>{{HTML text to be translated}}</span>

The use of {{ and }} should be safe for text editors that offer syntax checking and highlighting.

Installation

Prerequisites

Building this application requires Go. This has been tested with Go 1.6.

This tool could make use of third party tools to optimize output. These tools include: uglify-js2, cssmin, (html) tidy. At this time their gains are not adequate for what they cost is both in time and browser obfuscation.

If we were to use those, we would use those in post-processing. If the project does encourage post-processing again, we will document the post-processing commands. For now those remain dormant.

Building

#Make sure `GOPATH` is set in your environment.
echo $GOPATH
cd $GOPATH
mkdir -p $GOPATH/src/github.com/falling-sky
cd $GOPATH/src/github.com/falling-sky
git clone [email protected]:falling-sky/builder.git
cd builder 
go build
cp builder /path/to/falling-sky/source/

Shortcut from falling-sky source code

You might find it easier to use make builder from the falling-sky source directory. This will automatically set up a GOPATH for you, clone the source, and build the binary.

Configuration

The build tool does support a config file. Run this to get a template:

builder --example > builder.conf

And then, after editing the configuration..

builder --config builder.conf

fsbuilder's People

Contributors

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