Commit 49f3124b authored by Terion's avatar Terion

first comit

parents
{
"directory": "build/vendor"
}
\ No newline at end of file
---
BUNDLE_PATH: "."
BUNDLE_DISABLE_SHARED_GEMS: '1'
.idea
build
node_modules
.sass-cache
ruby
\ No newline at end of file
source "https://rubygems.org"
gem 'sass', "~> 3.4"
gem 'compass', "~> 1"
gem 'bootstrap-sass', '~> 3.3.5'
gem 'sass-globbing', '~>1'
gem 'compass-normalize', '~>1.5'
\ No newline at end of file
GEM
remote: https://rubygems.org/
specs:
autoprefixer-rails (5.2.1.2)
execjs
json
bootstrap-sass (3.3.5.1)
autoprefixer-rails (>= 5.0.0.1)
sass (>= 3.3.0)
chunky_png (1.3.4)
compass (1.0.3)
chunky_png (~> 1.2)
compass-core (~> 1.0.2)
compass-import-once (~> 1.0.5)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
sass (>= 3.3.13, < 3.5)
compass-core (1.0.3)
multi_json (~> 1.0)
sass (>= 3.3.0, < 3.5)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
compass-normalize (1.5)
compass (>= 0.12.0)
execjs (2.6.0)
ffi (1.9.10)
json (1.8.3)
multi_json (1.11.2)
rb-fsevent (0.9.5)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
sass (3.4.16)
sass-globbing (1.1.1)
sass (>= 3.1)
PLATFORMS
ruby
DEPENDENCIES
bootstrap-sass (~> 3.3.5)
compass (~> 1)
compass-normalize (~> 1.5)
sass (~> 3.4)
sass-globbing (~> 1)
{
"name": "terion.name",
"version": "0.0.1",
"authors": [
"Volodymyr 'Terion' Kornilov"
],
"license": "GPL",
"private": true,
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"velocity": "~1.2.2",
"promise-ajax-js": "*"
}
}
#!/bin/bash
bundle install
npm install
./node_modules/bower/bin/bower install
./node_modules/gulp/bin/gulp
\ No newline at end of file
FROM terion/static-web-build-runtime
ADD ./ /usr/share/nginx/
RUN cd /usr/share/nginx/ && ./build.sh
web:
build: ../../
dockerfile: environments/production/Dockerfile
\ No newline at end of file
gulp = require 'gulp'
gulp.task 'coffee', ->
include = require 'gulp-include'
uglify = require('gulp-uglify')
coffee = require "gulp-coffee"
ifElse = require('gulp-if-else')
argv = require('yargs').argv
gulp.src 'src/coffee/*.coffee'
.pipe include()
.pipe coffee()
.pipe ifElse(argv.production, uglify)
.on 'error', (e)-> console.error e
.pipe gulp.dest 'build/js'
\ No newline at end of file
gulp = require 'gulp'
gulp.task 'fonts', ->
gulp.src 'src/fonts/**/*'
.pipe gulp.dest 'build/fonts'
###
fontfacegen is too buggy...
fontfacegen = require('fontfacegen')
fs = require('fs')
path = require('path')
concat = require('concat-files')
fonts = fs.readdirSync('src/fonts/')
cssFiles = []
for font in fonts
extension = path.extname(font)
fontname = path.basename(font, extension)
if extension == '.ttf' or extension == '.otf'
fontfacegen
source: path.join('src/fonts/', font),
dest: 'build/fonts/',
collate: true
css: "build/fonts/#{fontname}.css"
css_fontpath: "/"
cssFiles.push "build/fonts/#{fontname}.css"
concat cssFiles, 'build/fonts/fonts.css'
###
\ No newline at end of file
gulp = require 'gulp'
gulp.task 'img', ->
imagemin = require 'gulp-imagemin'
pngquant = require 'imagemin-pngquant'
gulp.src 'src/img/**/*'
.pipe(imagemin({
progressive: true,
svgoPlugins: [{removeViewBox: false}],
use: [pngquant()]
}))
.pipe gulp.dest 'build/img'
\ No newline at end of file
gulp = require 'gulp'
gulp.task 'jade', ->
jade = require('gulp-jade')
rename = require("gulp-rename")
argv = require('yargs').argv
gulp.src 'src/jade/pages/*.jade'
.pipe jade {
basedir: 'src/jade/pages/'
pretty: !argv.production
locals: site_domain: 'example.com'
}
.pipe rename (path)->
unless path.basename == 'index'
path.dirname += "/" + path.basename
path.basename = "index"
path.extname = ".html"
.pipe gulp.dest 'build'
\ No newline at end of file
gulp = require 'gulp'
gulp.task 'js', ->
uglify = require('gulp-uglify')
gulp.src 'src/js/**/*'
.pipe uglify()
.pipe gulp.dest 'build/js'
\ No newline at end of file
gulp = require 'gulp'
gulp.task 'sass', ->
compass = require 'gulp-compass'
csso = require 'gulp-csso'
autoprefixer = require "gulp-autoprefixer"
ifElse = require('gulp-if-else')
argv = require('yargs').argv
gulp.src ['src/sass/*.sass', '!src/sass/_*', '!src/sass/_*/*']
.pipe compass
#project: '',
css: 'build/css/'
sass: 'src/sass/'
image: 'src/img/'
require: ['bootstrap-sass', 'sass-globbing', 'compass-normalize']
comments: false
style: 'expanded'
bundle_exec: true
.on 'error', (e)-> console.error e
.pipe(autoprefixer(browsers: ['last 2 version', 'safari 5', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'], remove: false))
.pipe ifElse(argv.production, csso)
.pipe gulp.dest 'build/css'
gulp = require 'gulp'
serve = require 'gulp-serve'
gulp.task 'serve', serve('./build')
\ No newline at end of file
# run with --production option for minified assets
gulp = require 'gulp'
requireDir = require('require-dir')
tasks = requireDir('./gulp')
gulp.task 'default', ['jade', 'fonts', 'img', 'sass', 'js', 'coffee']
gulp.task 'watch', ->
gulp.watch 'src/sass/**/*.sass', ['sass']
gulp.watch ['src/jade/**/*.jade'], ['pages']
gulp.watch 'src/coffee/**/*.coffee', ['coffee']
gulp.task 'sw', ['serve', 'watch']
\ No newline at end of file
require('coffee-script/register');
//require('gulp-task-loader')('gulp');
require('./gulpfile.coffee');
\ No newline at end of file
{
"name": "project.name",
"version": "0.0.1",
"description": "",
"private": true,
"main": "gulpfile.js",
"scripts": {
"test": "gulp"
},
"keywords": [
"GulpJS"
],
"author": "Volodymyr Kornilov",
"license": "BSD",
"dependencies": {
"bower": "~1.3",
"coffee-script": "~1.8",
"glob": "~4",
"gulp": "^3.8.9",
"gulp-autoprefixer": "1.0.1",
"gulp-coffee": "~2.2",
"gulp-compass": "~1.2",
"gulp-csso": "^0.2.9",
"gulp-if-else": "^1.0.3",
"gulp-imagemin": "^2.0.0",
"gulp-include": "^1.1.0",
"gulp-jade": "*",
"gulp-rename": "^1.2.0",
"gulp-serve": "^1.0.0",
"gulp-uglify": "^1.2.0",
"gulp-util": "~3.0",
"imagemin-pngquant": "^4.0.0",
"require-dir": "^0.3.0",
"yargs": "^3.19.0"
}
}
# Single language static sites template
* `gulp` for building dev
* `gulp --production` for building prod
Uses bundler for ruby packages (sass, compass, boottrap-sass, etc), bower for client assets, nodejs with gulp for other stuff
\ No newline at end of file
class ExampleController
constructor: (@container)->
@init()
@bind()
init: ->
bind: ->
\ No newline at end of file
fit = (fromW, fromH, toW, toH, round)->
targetW = 0
targetH = 0
ratio1 = fromW / fromH
ratio2 = toW / toH
leading = if ratio1 > ratio2 then 'w' else 'h'
if leading == 'w'
targetW = toW
targetH = targetW / ratio1
else
targetH = toH
targetW = targetH * ratio1
return [Math.round(targetW), Math.round(targetH)] if round
return [targetW, targetH]
fill = (fromW, fromH, toW, toH, round)->
targetW = 0
targetH = 0
marginLeft = 0
marginTop = 0
ratio1 = fromW / fromH
ratio2 = toW / toH
leading = if ratio1 < ratio2 then 'w' else 'h'
if leading == 'w'
targetW = toW
targetH = targetW / ratio1
marginTop = (toH - targetH) / 2
else
targetH = toH
targetW = targetH * ratio1
marginLeft = (toW - targetW) / 2
return [Math.round(targetW), Math.round(targetH), Math.round(marginLeft), Math.round(marginTop)] if round
return [targetW, targetH, marginLeft, marginTop]
addClass = (o, c) ->
re = new RegExp('(^|\\s)' + c + '(\\s|$)', 'g')
if re.test(o.className)
return
o.className = (o.className + ' ' + c).replace(/\s+/g, ' ').replace(/(^ | $)/g, '')
return
removeClass = (o, c) ->
re = new RegExp('(^|\\s)' + c + '(\\s|$)', 'g')
o.className = o.className.replace(re, '$1').replace(/\s+/g, ' ').replace(/(^ | $)/g, '')
return
hasClass = (o, c) ->
re = new RegExp('(^|\\s)' + c + '(\\s|$)', 'g')
return re.test(o.className)
nodeListToArray = (nodeList)->
arr = []
# seems this is faster then Array.prototype.slice
for node in nodeList
arr.push node
return arr
### inspired by https://gist.github.com/1129031 ###
###global document, DOMParser###
do (DOMParser) ->
'use strict'
proto = DOMParser.prototype
nativeParse = proto.parseFromString
# Firefox/Opera/IE throw errors on unsupported types
try
# WebKit returns null on unsupported types
if (new DOMParser).parseFromString('', 'text/html')
# text/html parsing is natively supported
return
catch ex
proto.parseFromString = (markup, type) ->
if /^\s*text\/html\s*(?:;|$)/i.test(type)
doc = document.implementation.createHTMLDocument('')
if markup.toLowerCase().indexOf('<!doctype') > -1
doc.documentElement.innerHTML = markup
else
doc.body.innerHTML = markup
doc
else
nativeParse.apply this, arguments
return
trim = (str, charlist) ->
# Strip whitespace (or other characters) from the beginning and end of a string
#
# + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
# + improved by: mdsjack (http://www.mdsjack.bo.it)
# + improved by: Alexander Ermolaev (http://snippets.dzone.com/user/AlexanderErmolaev)
# + input by: Erkekjetter
# + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
charlist = if !charlist then ' s ' else charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, '$1')
re = new RegExp('^[' + charlist + ']+|[' + charlist + ']+$', 'g')
str.replace re, ''
getQueryParams = (queryString)->
assoc = {}
decode = (s) -> decodeURIComponent s.replace(/\+/g, ' ')
queryString = location.search.substring(1) unless queryString
keyValues = queryString.split('&')
for i of keyValues
key = keyValues[i].split('=')
if key.length > 1
assoc[decode(key[0])] = decode(key[1])
assoc
transitionEndEventName = ->
el = document.createElement('div')
transitions =
'transition': 'transitionend'
'OTransition': 'otransitionend'
'MozTransition': 'transitionend'
'WebkitTransition': 'webkitTransitionEnd'
for i of transitions
if transitions.hasOwnProperty(i) and el.style[i] != undefined
return transitions[i]
#TODO: throw 'TransitionEnd event is not supported in this browser';
return
once = (node, type, callback)->
# create event
node.addEventListener type, (e) ->
# remove event
e.target.removeEventListener e.type, arguments.callee
# call handler
callback e
return
getLocation = (href) ->
match = href.match(/^(https?\:)\/\/(([^:\/?#]*)(?:\:([0-9]+))?)(\/[^?#]*)(\?[^#]*|)(#.*|)$/)
match and
protocol: match[1]
host: match[2]
hostname: match[3]
port: match[4]
pathname: match[5]
search: match[6]
hash: match[7]
\ No newline at end of file
#= require_tree _classes
# do stuff here
\ No newline at end of file
include ../mixins/menu.jade
include ../mixins/likes.jade
include ../mixins/ga.jade
include ../mixins/facebook_init.jade
include ../mixins/vk_init.jade
<!DOCTYPE html>
html(lang="en")
head
meta(charset="UTF-8")
meta( name="viewport", content="width=device-width")
block title
title Site title
link(rel="stylesheet", href="/fonts/stylesheet.css")
link(rel="stylesheet", href="/css/styles.css")
link(rel="icon", type="image/png", href="/img/favicon.png")
//- vendor scripts
script(src="/vendor/promise-ajax-js/promise.min.js")
//- script(src="/vendor/velocity/velocity.min.js")
block socials
meta(property="og:url", content="http://#{site_domain}")
meta(property="og:title", content="Site title")
meta(property="og:description", content="")
meta(property="og:image", content="http://#{site_domain}/img/fb_share.png")
meta(property="og:type", content="website")
meta(property="og:site_name", content="Site title")
//- meta(property="og:locale", content="en_US")
meta(property="fb:app_id", content="")
+vk_init('')
+ga('')
body
<!--[if lte IE 9]>
style.
body { overflow: hidden }
.oldie#oldie
.txt Your browser is too old, outdated and insecure.<br>Please update
<![endif]-->
+facebook_init('')
#header
img.logo(src='/img/logo.svg', alt='', title='')
block menu
+menu('home')
#container
block content
script(src="/js/scripts.js")
\ No newline at end of file
mixin facebook_init(appId)
#fb-root
script.
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4&appId=#{appId}";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
mixin ga(id)
script.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q || []).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', "#{id}", 'auto');
ga('send', 'pageview');
\ No newline at end of file
mixin likes(url, inverted)
.likes-widget(class=(inverted ? 'inverted' : ''))
.fb
.holder like
.container
.fb-like(data-href="#{url}", data-width='100', data-layout='button_count', data-action='like', data-show-faces='false', data-share='false')
.vk
.holder like
.container
.vk-like
script(type='text/javascript').
(function () {
var i, j, len, like, liker, likers, randomId, results, results1;
likers = document.getElementsByClassName('vk-like');
if (typeof VK !== "undefined" && VK !== null) {
i = 0;
results = [];
while (i < likers.length) {
liker = likers[i];
if (!liker.getAttribute('id')) {
randomId = 'vk_like_' + Math.ceil(Math.random() * Math.random() * 10000);
liker.setAttribute('id', randomId);
VK.Widgets.Like(randomId, {
height: 20,
type: "mini",
locale: 'en_US',
pageUrl: "#{url}"
});
}
results.push(i++);
}
return results;
} else {
results1 = [];
for (j = 0, len = likers.length; j < len; j++) {
like = likers[j];
results1.push(like.style.display = 'none');
}
return results1;
}
})();
.tw
.holder tweet
.container
a.twitter-share-button(href="#{url}", data-text='', data-via='terion_fallen') Tweet
script.
!function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
if (!d.getElementById(id)) {
js = d.createElement(s);
js.id = id;
js.src = p + '://platform.twitter.com/widgets.js';
fjs.parentNode.insertBefore(js, fjs);
}
}(document, 'script', 'twitter-wjs');
mixin menu(active)
nav.menu
ul
li(class=(active == 'home' ? 'active' : '')): a(data-screen='0', href='/') Home
\ No newline at end of file
mixin vk_init(appId)
script(type='text/javascript', src='//vk.com/js/api/openapi.js?116')
script(type='text/javascript').
VK.init({apiId: "#{appId}", onlyWidgets: true});
extends ../layouts/main
block content
h1 Hello
\ No newline at end of file
=middler
&:before
content: ''
vertical-align: middle
height: 100%
display: inline-block
width: 0
margin-left: -0.25ex
\ No newline at end of file
@import "compass"
@import "normalize"
@import "bootstrap-sprockets"
//@import "bootstrap"
@import "_partials/mixins"
body
margin-top: 0
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment