tools/gen-index: Generate getters
LoVullo dropped support for IE<9, so getters can now be used to lazy-load modules. This also means that, during the transition from LoVullo's internal rating-fw repo to liza, and broken require paths (program/, mainly) will not cause problems unless the module containing those requires is explicitly requested. * tools/gen-index.js: Generate getters.master
parent
a65f568714
commit
e3b6ee05fa
|
@ -40,7 +40,7 @@ for module in "$destpath"/!(index).js; do
|
|||
echo ,
|
||||
fi
|
||||
|
||||
echo -n " '$modname': require( './$modname' )"
|
||||
echo -n " get '$modname'() { return require( './$modname' ); }"
|
||||
done
|
||||
|
||||
# include index.js for any sub-directories (namespace)
|
||||
|
@ -52,7 +52,7 @@ for dir in $( find "$destpath" -maxdepth 1 -mindepth 1 -type d ); do
|
|||
echo ,
|
||||
fi
|
||||
|
||||
echo -n " '$ns': require( './$ns' )"
|
||||
echo -n " get '$ns'() { return require('./$ns'); }"
|
||||
done
|
||||
|
||||
echo -e "\n};"
|
||||
|
|
Loading…
Reference in New Issue