Skip to content

Instantly share code, notes, and snippets.

@iTonyYo
Last active August 29, 2015 14:03
Show Gist options
  • Save iTonyYo/9d7359ff69ef8336b151 to your computer and use it in GitHub Desktop.
Save iTonyYo/9d7359ff69ef8336b151 to your computer and use it in GitHub Desktop.
Global configuration & utility functions for web front-end project used Jade.
//
Build Passing.
Jade: 1.3.0+
Doctype: HTML5
#TODO[x]: Description
Global configuration & utility functions for web front-end project used Jade.
#TODO[x]: Dependencies
initialization.jade (//gist.github.com/Tony-Stark/9d7359ff69ef8336b151)
Author: 沈维忠 ( Shen Weizhong / Tony Stark )
Cell Phone: (+86) 15921299022
Github://github.com/Tony-Stark/
Trello: //trello.com/shenweizhong/
个人全球统一标识( Gravatar )://en.gravatar.com/swzcowboy/
个人主页( Personal Homepage )://tony-stark.github.io/
Linkedin://cn.linkedin.com/in/itonyyo/
Twitter: @iTonyYo, //twitter.com/iTonyYo/
Instagram://instagram.com/itonyyo/
Facebook://www.facebook.com/shenweizhong/
Google+: //plus.google.com/114960355664861539339/
Instagram: //instagram.com/itonyyo/
QQ:563214029, //user.qzone.qq.com/563214029/
Sina Weibo: //weibo.com/itonyyo/
WhatsApp:15921299022
微信( WeChat ):iTonyYo
Facebook Messenger:shenweizhong
Skype:live:swzyocowboy
Line:shenweizhong
Email: [email protected], [email protected], [email protected], [email protected], [email protected]
Version: 0.1.1-alpha
Creation Date: 2014.07.01 18:16 ( Tony ).
Last Update: 2014.08.16 16:05 ( Tony ).
//
> staticResourceOrigin = local / server.
-var staticResourceOrigin = 'local'
-var htmlFolderDepth = './'
//
var dirLocal = {
bowerComponents: htmlFolderDepth + 'bower_components/',
_public: htmlFolderDepth + 'public/'
};
-var dirLocal = {bowerComponents: htmlFolderDepth + 'app/bower_components/', _public: htmlFolderDepth + 'app/public/'}
//
var domainCDN = {
hengyuan: '//resource.fenqimall.com/',
baidu: '//libs.baidu.com/',
microsoft: '//ajax.aspnetcdn.com/',
google: '//ajax.googleapis.com/',
maxcdn: '//maxcdn.bootstrapcdn.com/',
cdnjs: '//cdnjs.cloudflare.com/',
jsdelivr: '//cdn.jsdelivr.net/'
};
-var domainCDN = {hengyuan: '//resource.fenqimall.com/', baidu: '//libs.baidu.com/', microsoft: '//ajax.aspnetcdn.com/', google: '//ajax.googleapis.com/', maxcdn: '//maxcdn.bootstrapcdn.com/', cdnjs: '//cdnjs.cloudflare.com/', jsdelivr: '//cdn.jsdelivr.net/'}
-var selectedCDN = domainCDN.microsoft
//
> Usage:
+ie('if lt IE 9]', '[endif')
link(rel='stylesheet', href='../../public/ajax/libs/css/normalize/1.1.3/normalize.min.css')
+ie('if gte IE 9]><!--', '--<![endif')
link(rel='stylesheet', href='../../public/ajax/libs/css/normalize/3.0.0/normalize.min.css')
mixin ie (sCondition, eCondition)
|<!--[!{sCondition}>
block
|<!!{eCondition}]-->
//
> Usage:
+setScriptLoader('ajax/libs/js/sucker.js', 'ajax/libs/js/requirejs/2.1.14/require.min.js')
mixin setScriptLoader (bootScriptUrl, scriptLoaderUrl)
if staticResourceOrigin === 'local'
script(data-main= dirLocal._public + bootScriptUrl, src= dirLocal.bowerComponents + 'requirejs/require.js')
else
script(data-main= selectedCDN + bootScriptUrl, src= selectedCDN + scriptLoaderUrl)
//
> Usage(with bower):
+importCSS('ajax/libs/css/sucker.css', true)
> Usage(no bower):
+importCSS('ajax/libs/css/sucker.css', false)
or:
+importCSS('ajax/libs/css/sucker.css')
mixin importCSS (specificUrl, bower)
if staticResourceOrigin === 'local'
if bower
link(rel= 'stylesheet', href= dirLocal.bowerComponents + specificUrl)
else
link(rel= 'stylesheet', href= dirLocal._public + specificUrl)
else
link(rel= 'stylesheet', href= selectedCDN + specificUrl)
//
> Usage:
+importJS('ajax/libs/js/sucker.js')
> Usage(no bower):
+importJS('ajax/libs/js/sucker.js', false)
or:
+importJS('ajax/libs/js/sucker.js')
mixin importJS (specificUrl, bower)
if staticResourceOrigin === 'local'
if bower
script(src= dirLocal.bowerComponents + specificUrl)
else
script(src= dirLocal._public + specificUrl)
else
script(src= selectedCDN + specificUrl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment