Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master #1

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions assets/gulp/config.coffee
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
neat = require('node-neat').includePaths
dest = "../bld"
src = "./src"

Expand All @@ -16,16 +15,15 @@ module.exports =
src: "styl/src/**"
dest: dest
settings:
sourceComments: 'map',
imagePath: '/img',
errLogToConsole: true,
includePaths: ['sass'].concat(neat)
sourceComments: 'map'
imagePath: '/img'
errLogToConsole: true

markup:
src: ['../*.html', '../*.php', '../inc/*.php', '../templates/*.php']

images:
src: "/img/**"
src: "img/**/*"
dest: dest + "/img"

browserify:
Expand Down
Empty file modified assets/gulp/tasks/browserSync.coffee
100755 → 100644
Empty file.
7 changes: 7 additions & 0 deletions assets/gulp/tasks/browserify.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ bundleLogger = require '../util/bundleLogger'
gulp = require 'gulp'
handleErrors = require '../util/handleErrors'
source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
uglify = require 'gulp-uglify'
rename = require 'gulp-rename'
config = require('../config').browserify
_ = require 'lodash'

Expand All @@ -28,6 +31,10 @@ browserifyTask = (callback, devMode) ->
.on 'error', handleErrors
.pipe(source(bundleConfig.outputName))
.pipe(gulp.dest(bundleConfig.dest))
.pipe(buffer())
.pipe(uglify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest(bundleConfig.dest))
.on 'end', reportFinished
.pipe(browserSync.reload
stream: true
Expand Down
Empty file modified assets/gulp/tasks/default.coffee
100755 → 100644
Empty file.
15 changes: 10 additions & 5 deletions assets/gulp/tasks/images.coffee
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
changed = require 'gulp-changed'
gulp = require 'gulp'
imagemin = require 'gulp-imagemin'
config = require('../config').images
changed = require 'gulp-changed'
gulp = require 'gulp'
imagemin = require 'gulp-imagemin'
pngquant = require('imagemin-pngquant');
config = require('../config').images
browserSync = require 'browser-sync'

gulp.task 'images', ->
return gulp.src(config.src)
.pipe(changed(config.dest))
.pipe(imagemin())
.pipe(imagemin({
progressive: true
svgoPlugins: [{removeViewBox: false}]
use: [pngquant()]
}))
.pipe(gulp.dest(config.dest))
.pipe(browserSync.reload
stream: true
Expand Down
8 changes: 6 additions & 2 deletions assets/gulp/tasks/sass.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ sourcemaps = require('gulp-sourcemaps')
handleErrors = require('../util/handleErrors')
config = require('../config').sass
autoprefixer = require('gulp-autoprefixer')
neat = require('node-neat').includePaths
rename = require 'gulp-rename'
minifyCSS = require 'gulp-minify-css'
neat = require('node-neat').includePaths
modal = require('kbd-modal').includePaths

gulp.task 'sass', ->
return gulp.src('styl/src/screen.scss')
Expand All @@ -14,11 +17,12 @@ gulp.task 'sass', ->
sourceComments: 'map'
imagePath: '/img'
errLogToConsole: true
includePaths: ['sass'].concat(neat)
includePaths: ['sass'].concat(modal).concat(neat)
)
.pipe(autoprefixer
browsers: ['last 2 version']
)
.pipe(minifyCSS())
.pipe(sourcemaps.write())
.on('error', handleErrors)
.pipe(gulp.dest(config.dest))
Expand Down
Empty file modified assets/gulp/tasks/setWatch.coffee
100755 → 100644
Empty file.
20 changes: 0 additions & 20 deletions assets/gulp/tasks/uglify.coffee

This file was deleted.

2 changes: 1 addition & 1 deletion assets/gulp/tasks/watch.coffee
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ config = require '../config'
watchify = require './browserify'

gulp.task 'watch', ['setWatch','browserSync'], (callback) ->
gulp.watch('./js/src/*.coffee', ['browserify'])
# gulp.watch('./js/src/*.coffee', ['browserify'])
# gulp.watch('../bld/app.js', ['uglify'])
gulp.watch(config.sass.src, ['sass'])
gulp.watch(config.images.src, ['images'])
Expand Down
Empty file modified assets/gulp/util/bundleLogger.coffee
100755 → 100644
Empty file.
Empty file modified assets/gulp/util/handleErrors.coffee
100755 → 100644
Empty file.
111 changes: 111 additions & 0 deletions assets/js/lib/header.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#*--------------------------------------------------------*#
# Header
#*--------------------------------------------------------*#

mobileMenu = require './menu'
classie = require 'classie'
_ = require 'lodash'

header =

header: document.getElementsByClassName('header')[0]
nav: document.getElementsByClassName('nav')[0]
home: document.querySelector('a[title="home"]')
menuItems: document.getElementsByClassName 'menu-item'
logo: document.querySelector('.header-logo')
search: document.querySelector '.search-util a'
banner: document.getElementsByClassName('block-banner')[0]
navUtil: document.getElementsByClassName('nav-util-menu')[0]
html: document.getElementsByTagName('html')[0]

headerLoad: ->
classie.add @header, 'header-load'
return

# addPhoneIcon: ->
# phone = document.createElement 'li'
# phone.className = 'menu-item'
# phone.innerHTML = '<span class="moovweb-phone">1.877.666.8932</span><span class="icon-phone"></span>'
# @navUtil.appendChild(phone)
# return

# addPhoneListener: ->
# phone = document.getElementsByClassName('icon-phone')[0]
# phone.addEventListener 'mouseover', (event) ->
# num = phone.parentNode.querySelector('.moovweb-phone')
# if !classie.has(num, 'moovweb-phone-visible')
# classie.add(num, 'moovweb-phone-visible')
# return
# return

mobileMenuInit: ->
menu = new mobileMenu()
menu.init()

addBannerClass: ->
if @banner?
classie.add(@header, 'header-with-banner')
return true
else
return false

addHeaderPadding: ->
height = @header.offsetHeight
if not @banner?
block = document.getElementsByClassName('block')[0]
blockPaddingTop = parseInt(window.getComputedStyle(block).paddingTop, 10)
block.style.paddingTop = blockPaddingTop + height + 'px'
return

addScrollClass: ->
_this = @
if classie.has(@html, 'mobile-browser')
classie.add(_this.header, 'header-scrolled')
else
window.addEventListener 'scroll', _.debounce ->
console.log 'hello'
y = window.pageYOffset
if y > 100
classie.add(_this.header, 'header-scrolled')
else if y < 100
classie.remove(_this.header, 'header-scrolled')
, 20

setLogo: ->
navHeight = @nav.offsetHeight
@home.innerHTML = '<img src="' + protocol + '//' + host + '/cnt/themes/thm/assets/img/logo.png" class="header-logo">'

@logo.style.height = navHeight - 32 + 'px'

if window.innerWidth < 801
menuButton =document.getElementById 'open-button'
mBHeight = menuButton.offsetHeight
mBMargin = (navHeight - mBHeight)/2
menuButton.style.top = mBMargin + 'px'
menuButton.style.right = mBMargin + 'px'
return

fixedHeader: ->
height = @header.offsetHeight
newDiv = document.createElement 'div'
newDiv.style.height = height + 'px'

wrapper = document.getElementsByClassName('wrapper')[0]
wrapper.insertBefore(newDiv,wrapper.childNodes[1])

init: ->
_this = @
#@addPhoneIcon()
#@addPhoneListener()
#@addBannerClass()
#@addHeaderPadding()
@mobileMenuInit()
@setLogo()
@fixedHeader()
window.addEventListener 'load', ->
_this.headerLoad()
#_this.addScrollClass()
return


module.exports = header
18 changes: 18 additions & 0 deletions assets/js/lib/typography.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#*--------------------------------------------------------#
# Typography Methods
#*--------------------------------------------------------#
_ = require 'lodash'

typography =
nowidows: (els) ->
for el in els
do (el) ->
if el.innerHTML.indexOf('<br>') is -1
text = el.textContent
words = _.words( text )
if words.length > 4
words[words.length - 3] += '&nbsp;' + words[words.length - 2] + '&nbsp;' + words[words.length - 1]
words.splice(words.length - 1, 2)
el.innerHTML = words.join ' '

module.exports = typography
15 changes: 15 additions & 0 deletions assets/js/lib/utils.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#*--------------------------------------------------------*#
# Utilities
#*--------------------------------------------------------*#
utils =

# Sets Items
equalizr: (className) ->
items = document.getElementsByClassName className
if items[0]?
width = items[0].offsetWidth
for el in items
do (el) ->
el.style.height = width + px

module.exports = utils
41 changes: 40 additions & 1 deletion assets/js/src/app.coffee
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
jQuery ($) ->
#*--------------------------------------------------------#
# Global Object Variables
#*--------------------------------------------------------#
getByClass =
header: document.getElementsByClassName('header')[0]
footer: document.getElementsByClassName('footer')[0]
wrapper: document.getElementsByClassName('wrapper')[0]

location =
protocol: window.location.protocol
host: window.location.host
path: window.location.pathname

#*--------------------------------------------------------#
# Requires
#*--------------------------------------------------------#
classie = require 'classie'
_ = require 'lodash'
modal = require 'kbd-modal'.Modal
header = require './lib/header'
typography = require './lib/typography'
utils = require './lib/utils'

#*--------------------------------------------------------#
# Inits
#*--------------------------------------------------------#
header.init()

m = new modal('md-trigger', '[id^="md"]', 'md-close')
m.init()


#*--------------------------------------------------------#
# Window Load and Resize
#*--------------------------------------------------------#
window.addEventListener 'load', ->
classie.add(wrapper, 'clean-load')

#window.addEventListener 'resize', _.debounce(->
#, 150)
25 changes: 18 additions & 7 deletions assets/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "thm",
"version": "1.1.0",
"description": "Starter Theme for WP",
"version": "1.0.0",
"description": "General WP Theme",
"browserify": {
"transform": [
"coffeeify"
Expand All @@ -11,25 +11,36 @@
"browser-sync": "^1.9.1",
"browserify": "^8.1.1",
"browserify-shim": "^3.8.2",
"classie": "^0.1.0",
"coffee-script": "^1.8.0",
"coffeeify": "^0.7.0",
"d3": "^3.5.5",
"es6-promise": "^2.0.1",
"gulp": "^3.8.7",
"gulp-autoprefixer": "^2.1.0",
"gulp-changed": "^1.1.0",
"gulp-filesize": "0.0.6",
"gulp-imagemin": "^2.1.0",
"gulp-minify-css": "^0.4.2",
"gulp-minify-css": "^1.0.0",
"gulp-notify": "^2.1.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^1.3.2",
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "^1.1.0",
"gulp-util": "^3.0.2",
"handlebars": "^2.0.0",
"lodash": "^2.4.1",
"node-bourbon": "^1.2.3",
"node-neat": "^1.4.2",
"imagemin-pngquant": "^4.0.0",
"imagesloaded": "^3.1.8",
"isotope-layout": "^2.1.1",
"isotope-packery": "^1.1.0",
"kbd-dropdown": "0.0.1",
"kbd-modal": "^1.1.8",
"layzr.js": "^1.0.1",
"lodash": "^3.6.0",
"masonry-layout": "^3.2.2",
"pretty-hrtime": "^1.0.0",
"require-dir": "^0.1.0",
"scrollmagic": "^2.0.3",
"velocity-animate": "^1.2.2",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.0.0",
"watchify": "^2.2.1"
Expand Down
Loading