Skip to content

Commit

Permalink
auto-link scss folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Sep 17, 2014
1 parent 995e842 commit 20fd8b9
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions build/init.py
@@ -1,15 +1,21 @@
import os
from os.path import exists, join, dirname
from os import symlink


def init(conf, indir):
jsdir = conf.get('js', indir + '/js')
cssdir = conf.get('css', indir + '/css')
assets = os.path.dirname(os.path.dirname(__file__))
for name in ('js', 'css', 'scss'):
basedir = join(indir, conf.get(name, name))
if not exists(basedir):
continue

if not os.path.exists(jsdir + '/lib'):
os.symlink(assets + '/js', jsdir + '/lib')
elif not os.path.exists(jsdir + '/lib/wq'):
os.symlink(assets + '/js/wq', jsdir + '/lib/wq')
# Project lib directory (e.g. myapp/js/lib)
projpath = join(basedir, 'lib')
# wq source directory (e.g. wq.app/js)
wqpath = join(dirname(dirname(__file__)), name)

if not os.path.exists(cssdir + '/lib'):
os.symlink(assets + '/css', cssdir + '/lib')
if not exists(projpath):
# e.g myapp/js/lib -> wq.app/js
symlink(wqpath, projpath)
elif exists(join(wqpath, 'wq')) and not exists(join(projpath, 'wq')):
# e.g myapp/js/lib/wq -> wq.app/js/wq
symlink(join(wqpath, 'wq'), join(projpath, 'wq'))

0 comments on commit 20fd8b9

Please sign in to comment.