This project provides an awesome server and framework for almost any frontend project. It is all about building and running web frontends – and making it easy, efficient and fun.
Hey, how would you like to build websites from clean, encapsulated modules that contain their markup, scripts, styles and even tests?
xtc implements Terrific.js' clever, yet simple frontend modularization pattern in Node.js and Express. It lets you use simple Handlebars syntax to construct pages from re-usable modules that you call in your templates. The modules encapsulate different areas of code, preventing collisions and make hassle-free collaboration possible.
xtc sets up Express and uses Grunt and Yeoman to take as much work away from you as possible. It automatically builds your assets and generates new modules for you. xtc projects can be deployed in a snap. All you have to do is code.
To include a module in a view or another module you simply write:
{{mod "example"}}
That is the shortest form. The module call can take many different options tough.
As mentioned earlier Terrific modules are self-contained Frontend components. A module basically is a folder with a structure like this:
my-module/
my-module.hbs
my-module-variation.hbs
my-module.js
my-module.less
test/
my-module.test.js
skins/
my-module-variation.js
my-module-variation.less
sprites/
icon.png
This example is for a full-fledged module (including sprites). A module however can also just consist exclusively of markup or styling or logic.
A markup module is rendered in a wrapper.
<section class="mod mod-my-module">
my-module's markup
</section>
The wrapper serves as an exclusive context or namespace for the module's DOM logic and style sheets. A JS-only module can be applied "globally', i.e. to the whole page.
New modules can be generated with an interactive little CLI tool. You start it with:
npm run mkmod
The frontend code is structured into different phases.
These phases are processed in separate build pipelines and used as separate resources in the browser.
By default xtc contains an extremely helpful CSS framework called ⇗ such.less. More details coming soon. Wow.
Want more features? There are more.
npm install -g xtc-cli yo grunt-cli
.xtc install
.xtc build
.xtc start
.localhost:3000
in a browser.That's it. Start building websites!
There's an extensive documentation to familiarize you with all aspects of xtc.