A lean HTML & SASS boilerplate for better front-end coding
https://sanographix.github.io/rin/
- Node.js
$ git clone git@github.com:sanographix/rin.git test-repo
$ cd test-repo
$ npm install
$ npm start
While you are running Rin, It is watching directories under src/
. Put your projectβs templates(ejs), scss, js, images files in it.
templates/
, scss/
, js/
, images/
files will compile and output to build/
.
rin/
β£β³ src/
ββ£ templates/
ββ£ scss/
ββ£ js/
ββ images/
β
ββ³ build/
ββ³ index.html
β£ css/
β£ js/
β images/
Rin supports EJS template. When you edit and save .ejs
files under src/templates/pages
, they will output as .html
to build/
directory.
Put variables which use for every pages.
Example:
{
"siteName": "Example Site",
"siteRootUrl": "http://example.com/",
"ogImageUrl": "http://example.com/images/og-image.jpg",
"fbAppId": "000000000",
"twitterSite": "@sanographix",
"googleAnalyticsId": "UA-00000000-1"
}
To use variables for particular single page, put variables into <% var %>
at each page.
<% var
pageTitle = "Toppage";
pageDescription = "Example site";
%>
<head>
<title><%= pageTitle %> - <%= siteName %></title>
<meta property="og:description" content="<%= pageDescription %>" />
</head>
<head>
<title>Toppage - Example Site</title>
<meta property="og:description" content="Example site" />
</head>
Rin optimizes gif, jpg, png, svg images automatically using imagemin. Each files will output to build/images/
.
Rin supports scss.
sass
β£ style.scss // It imports under /lib files
β lib
β£ _core.scss // Edit this files mostly
β£ _button.scss // Buttons
β£ _common.scss // Common components like `body` or `a` etc
β£ _grid.scss // Responsive grid system
β£ _normalize.scss // Normalize
β _variable.scss // Color variables
It helps you make simple grid system. Like this:
<div class="l-container">
<div class="l-row">
<div class="l-span4">
Column A
</div>
<div class="l-span4">
Column B
</div>
<div class="l-span4">
Column C
</div>
</div>
</div>
<div class="l-container">
<div class="l-row">
<div class="l-span6">
Column A
</div>
<div class="l-span6">
Column B
</div>
</div>
</div>
Example:
<a class="btn">Normal button</a>
<a class="btn btn-light">Light color button</a>
<a class="btn btn-primary">Primary button!</a>
<a class="btn btn-lg">Large button!!</a>
Color variables and breakpoints of browser window width.
mq-xs
- Smartphone (<480px)
mq-sm
- Smartphone, Tablet (>576px)
mq-md
- Tablet (>768px)
mq-lg
- Medium desktop display (>992px)
mq-xl
- Large desktop display (>1200px)
mq-xxl
- Extra large desktop display (>1600px)
header h1 {
font-size: 100%;
@media #{$mq-xs} {
font-size: 80%;
}
@media #{$mq-sm} {
font-size: 150%;
}
@media #{$mq-md} {
font-size: 200%;
}
@media #{$mq-lg} {
font-size: 300%;
}
}
js files under src/js/
will output to build/js/scripts.js
with concatenated and compressed.
Rin runs local server by using BrowserSync. Its default URL is http://localhost:3000/. It reloads your browser automatically when you update a file.
Run git subtree
command.
git subtree push --prefix build/ origin gh-pages
Graphic designer from Kyoto.
- https://sanographix.net/
- Twitter: @sanographix
MIT