Frast makes your frontend dev fast. It provides an out-of-the-box toolset to code static pages from scratch, providing best developper experience and focusing on performance.
Frast is perfect for:
For example, this page is built with Frast :)
Frast is built over gulp and comes with awesome services and best practices. It has been developped, keeping in mind the "Keep It Simple Stupid" adage.
All your source codes are checked, optimized, compiled and served throught a light micro-server. You can access the result on your browser, update your work easily, and publish it on github.io in a minute.
All tools are integrated to make you work fast with a default optimized config. But you can easily turn anything on/off or custom any of their options.
You have not to adopt Frast. Frast adapts to your needs. If it fails, fork it to break it! Or ask us to improve it.
- git clone http://github.com/tilap/frast.git myproject
- cd myproject
- make install
- make watch
Clone the repo. Install the dependancies. Start coding.
You can access all the other magic with a few command lines.
Frast comes with html, javascript and less compilation. But you don't loose time asking for compilation everytime nor refreshing your browser.
Frast watchs any change on your files. When you save a file, Frast compiles and refresh the changes on your browser. Moreover, Frast only reloads what's needed: you change a less file, only the CSS will be live reloaded.
You see what you code in realtime, adjust quickly your code to get what you aim to.
While coding fast, you sometimes do mistake in your code: bad html tagging, error in you javascript file, ...
"Errare humanum est, perseverare diabolicum"
Frast provides live linting on compilation and checks the code of any file you save. If there is an error, you'll know it instantly with a smart desktop notification. Clean code has never been so easy.
Frast comes with bower. It installs bower locally, so you don't need to install it globally on your computer or bother about the version.
Updating the bower.json file, you can add thousands of frontend library fast, no matter of dependancies.
If you often use the same components and they are not in bower, include them fast with browserify.
Or code clean by separating you javascript features and take advantage of javascript require function.
Thanks to gulp plugins, Frast allows to include external html or markdown files (wich of course are parsed on compilation).
Thus you can easily put your customer contents. Or reuse the same files in many places, on many pages.
While you're coding a mockup or some frontend test, you often need images but you don't have time finding, croping, resizing somes that won't be kept.
Frast comes with a easy-to-use helper you can put anywhere in your html to insert a random image. For example, write that in your html file:
Frast comes with fontello automation. Open your current frast project fonticon, edit it in fontello GUI, add, edit, custom, save, and they are available in your project.
If you have no fonticon coz your not a designer, you can access all the fonticon preset easily.
If you need lots of small images, you'll probably want to use sprites. Frast comes with a task generating your sprite automaticall and the LessCss class to use it.
Just drop your images in a the sprite project folder, and use the css class.
Once you're happy with your webpages, you can publish it on github.io.
Frast will be clean, compil again to keep sure everything is good and push on the gh-pages of your repo. Your website will be available on http://username.github.io/repositoryname/
As Frast optimize html, css, javascript, images, ... the page will look really good and load fast.
By changing the configuration, you can push you static page on any other repository/branch.
- make githubio
- make publish
make install
Will install all the dependancies for the first time (node and bower packages) and copy a samble config file.
make update
Update the dependancies (npm and bower) after prune to keep installed packages cleaned.
make watch
Start the local webserver and watch all the sources files, triggering live reload on usefull file changes.
make githubio
Initialize the local and remote gh-pages branch. Delete the existing ones if any.
make publish
Publish the static webpages built on the gh-pages branch of your repositoriy.
make clean
Clean all the useless stuff. Usefull when you need to tar you code.
make fontopenmac
Open the project fonticon library on your browser (for Mac users)
make fontopenlinux
Open the project fonticon library on your browser (for Linux users)
make fontsave
Once you have edited your font on fontello, use it to import your fonticon in your project.
First of all, install Frast (see "Install Frast in a minute" section above)
Checkout and take a llok at the demo branch of the repo. It's the source code of the current page.
All your source code is in the "src" folder. Subfolders are explicitly named:
Set your configuration values in the config.js 'contentdata' property. Then use ejs standard markers. Example :
In config.js
module.exports = {
contentdata: {
app: {
name: 'Frast'
},
author: 'Tilap'
},
server: {
...
In a html top level page:
<%- app.name %>
<%- author %>
To include a basic html:
@@include('./includes/my-file.html')
To include a html, setting some content vars:
@@include('./includes/my-file.html', {
var1: 'my var 1 value is wonderfull',
var2: 'my var 2 value is awesome'
})
In your ./includes/my-file.html file, you'll be able to display the vars values anywhere in the dom with:
@@var1
@@var2
To include a markdown file that will be compiled in html:
@@include(markdown('./includes/my-markdown.md'))
Thanks to Lorem Pixel service, you can set random image for your mockup anywhere in your top level html page. For a 400px x 250px random image, use that for example:
<%- randomImg(400, 250, 'nightlife') %>
You can set the following categories: abstract, animals, business, cats, city, food, nightlife, fashion, people, nature, sports, technics, transport.
The compliation task use usemin plugin. SO in your html, you can merge many external css/js files with it. For example:
<!-- build:js js/bundle.js -->
<script src="../../vendor/jquery/dist/jquery.js"></script>
<script src="js/app.js"></script>
<!-- endbuild -->
Will merge ../../vendor/jquery/dist/jquery.js and js/app.js files, compress them, rename the whole result in js/bundle.js file. Moreover, it will add a unique suffix (ie somthing like js/bundle-01234.js) automatically and replace the whole closure with a beautifull
<script src="js/bundle-01234.js"></script>
The suffix is a hash based on file content, so it avoid browser script/css file caching.
You can do the same with css:
<!-- build:css stylesheet/style.css -->
<link rel="stylesheet" href="../../tmp/stylesheet/stylesheet.css" />
<!-- endbuild -->
(here only one file, but will still be renamed with a hash suffix so no brwoser cache problem).
Frast is built over bower. If you don't know bower, here a really basic usage (try learning the few thing to know by asking Google...). To install bootstrap for example:
bower install --save bootstrap
Less is compiled by default with bower directory as additional path. So just put something like :
@import 'bootstrap/less/mixins/vendor-prefixes.less';
or if you want the whole bootstrap css file:
@import (inline) 'bootstrap/dist/css/bootstrap.css';
You have 2 main ways do to it. Some external libraries can be browserified, so just use require.
If not, use the html helper describes above.
Just read and edit the config.js file after installing.