This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original source: https://www.kirupa.com/html5/get_element_position_using_javascript.htm | |
// Helper function to get an element's exact position | |
function getPosition(el) { | |
var xPos = 0; | |
var yPos = 0; | |
while (el) { | |
if (el.tagName == "BODY") { | |
// deal with browser quirks with body/window/document and page scroll | |
var xScroll = el.scrollLeft || document.documentElement.scrollLeft; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('rename', function () { | |
var fs = require('fs'); | |
var fileList = ''; | |
fs.readdir('sass/test', function(err, files) { | |
files.forEach(function (file) { | |
console.log('file: ', file); | |
fs.rename('sass/test/' + file, 'sass/test/_' + file, function (err) { | |
if (err) console.log('ERR: ' + err); | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('webpack', function () { | |
console.log('TASK:WEBPACK'); | |
/* | |
* run in gulp: gulp webpack --target=prod | |
* to create prod JS | |
* */ | |
if (gutil.env.target == 'prod') { | |
webpackConfig.plugins = [ | |
new webpack.optimize.DedupePlugin(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Utility to create index file with a list of all files - TOC | |
* */ | |
gulp.task('create-toc', function () { | |
var fs = require('fs'); | |
var fileList = ''; | |
fs.readdir('pages/cats', function(err, files) { | |
files.forEach(function (file) { | |
fileList += '<li><a href="'+ file +'">'+ file +'</a></li>'; |
NewerOlder