Old fashioned browser install, providing window.Apage
:
<script src="http://apage.richplastow.com/build/apage.js"></script>
<script>console.log( new window.Apage().I ); // -> 'Apage'</script>
Install as a CommonJS Module, eg for Node:
var Apage = require('apage');
console.log( new Apage().I ); // -> 'Apage'
Install using RequireJS inline-style, providing Apage
as an argument:
<script src="lib/require.js"></script>
<script>
require(['path/to/apage'], function(Apage) {
console.log( new Apage().I ); // -> 'Apage'
})
</script>
@todo more installation examples, including $ npm install -g apage
, etc.
Test with npm run-scripts on the command line:
npm test
Test on the client:
Open test/run-test.html in
a web browser
The following modules are listed in the "devDependencies"
field of
‘package.json’, so running npm install
will install them in the local
‘node_modules’ directory. However, you may find it useful to install them
globally on your machine, in which case the -g
flag is your friend:
Install coffee 1.9.2 on the command line:
npm install -g coffee-script
Install nodemon 1.3.7:
npm install -g nodemon
npm run build
@todo discussion of the limitations of file-watching.
hi
Opens up four useful project windows, saving you a few precious seconds at the
start of a development session. You will need Sublime Text installed, and a
symlink to its subl
binary added to your PATH.
@todo cross-platform, eg xdg-open
(*nix) and start
(win)
npm run hi
Which runs:
open .; open index.html; open test/run-test.html; subl .
Which means:
v:list
Shows a list of files which contain the version
string from ‘package.json’.
Each filename is suffixed by a colon, followed by the line-number where the
version string appears, eg README.md:1 package.json:4
.
npm run v:list
Which runs:
grep -ron $npm_package_version {bin,src,*.json} | awk 1 ORS=' ' | sed "s@:$npm_package_version@@g"
Or verbosely:
grep --recursive --only-matching --line-number $npm_package_version \\
{bin,src,*.json} \\
| \\
awk 1 ORS=' ' \\
| \\
sed "s@:$npm_package_version@@g"
Which means:
grep
to get a newline-delimited list of files which contain the
version
string from ‘package.json’--recursive
search in subdirectories--only-matching
don’t show leading/trailing context in the results--line-number
included after a colon, eg bower.json:3
awk
sed
:1.2.3-4
If you want to find for a particular string in the repo content, use:
grep -r 'the string' *
v:open
Opens a list of files which contain the version
string from ‘package.json’ in
Sublime Text. You will need Sublime Text installed, and a symlink to its subl
binary added to your PATH.
npm run v:open
Which runs:
subl $(npm run v:list --loglevel silent)
Note --loglevel silent
, which prevents subl
from being sent the results-log
which npm run
usually outputs.