OCB is an opinionated Frontend developer repository meant to be the quickest way to get off developing a prototype. This means that this repository is meant to be cloned or forked or abused. Features include:
- Webpack for front end module dependency
- Source Maps
- Custom path aliasing on the frontend to avoid 'require hell'
- Gulp for task running
- Karma and Jasmine for unit tests
- Express server with MYSQL
- SASS support (compiliation + minification)
- File watches
- Backbone Base and Form View
To get started clone this repository by running
git clone https://github.com/ziyadparekh/OCB.git
cd
into the directory and run npm install
If everything worked out ok you should be able to run:
supervisor application/app.js
from theroot
gulp
in another tab on your terminal- then navigate your browser to
localhost:3010
STRUCTURE::
- Server side stuff including the Express app, database files, routes configuration etc is located in the
application
directory. - Frontend javascript and SASS code is located in the
src
directory - Frontend
html (underscore)
templates are located in thepublic
directory - Compiled
js
andscss
assets also go into the public directory - Server side
ejs
templates are located in theviews
directory - Unit tests are located in
src/tests
directory
ADDITIONAL::
This Repository is meant to be modular and scalable so it is not technically a "single-page" javascript app. Express routes are mapped to functions which render an ejs
template. Something similar to support for multiple entry points. Similary each ejs
template has a compiled css
and js
file. The js
file is usually known as an entry file and is usually contained in the src/js/entries
directory. The js
and scss
file is compiled by Webpack and Gulp before it is loaded onto the page. Thus in development you see compiled files (but source maps help with debugging).
NOTE::
In order to use mysql and a database you need to install MYSQL yourself either through homebrew or through their website. Additionally once you have that installed, you need to set up a database (name, users, port, password etc). Once that is done edit the file OCB/application/helpers/connection
with your database info. (MYSQL isn't required to use this repo, its just an added benefit if you choose to build out your prototype with a db).
TODO::
- Add support for es6
- Make source maps better
- Make this repository better