Code Monkey home page Code Monkey logo

simple-static-boilerplate's Introduction

Static Site Boilerplate

A simple boilerplate for static sites

Boilerplate includes;

  • Grunt Utilities + Watchers
  • SASS + Compass Framework
  • Consistent static directory structure
  • jQuery as a git submodule

Cloning

To clone the repository, use git clone --recursive <url> to ensure git submodules included.

Changing Library Versions

Libraries are included as git submodules.

This makes for easy library version management, and keeps the commits cleaner.

For example, to checkout Ember.js @ 1.8.0-beta.5

## Submodule configuration
SUBMODULE_NAME=ember                ## Name of the submodule
SUBMODULE_VERSION=1.8.0-beta.5      ## Submodule version to checkout
SUBMODULE_TAG=Ember.js              ## Submodule Git tag, for $ git log --grep
SUBMODULE_PATH=www/static/js/lib    ## Path to submodules

## Update .gitmodules
git config -f .gitmodules submodule.$SUBMODULE_PATH/$SUBMODULE_NAME.branch $SUBMODULE_VERSION
## Checkout the new version of the module
git --git-dir .git/modules/$SUBMODULE_PATH/$SUBMODULE_NAME checkout $SUBMODULE_VERSION
## Add the .gitmodules and the submodule to the commit
git add .gitmodules $SUBMODULE_PATH/$SUBMODULE_NAME
## Commit the new version of the module
git commit -m "JavaScript,Libraries,$SUBMODULE_TAG: $SUBMODULE_TAG @ $SUBMODULE_VERSION"

Adding a Library

Libraries are easy to include with the following script, as well

For example, to add Ember.js @ 1.7.0

## Submodule configuration
SUBMODULE_URL="https://github.com/components/ember.git"
SUBMODULE_NAME=ember                ## Name of the submodule
SUBMODULE_VERSION=1.7.0             ## Submodule version to checkout
SUBMODULE_TAG=Ember.js              ## Submodule Git tag, for $ git log --grep
SUBMODULE_PATH=www/static/js/lib    ## Path to submodules

## Add the submodule
git submodule add $SUBMODULE_URL $SUBMODULE_PATH/$SUBMODULE_NAME
## Set the .gitmodules branch
git config -f .gitmodules submodule.$SUBMODULE_PATH/$SUBMODULE_NAME.branch $SUBMODULE_VERSION
## Add a newline to the file
echo >> .gitmodules
## Checkout the version
git --git-dir .git/modules/$SUBMODULE_PATH/$SUBMODULE_NAME checkout $SUBMODULE_VERSION

## Link the libray
GIT_DIRECTORY=$(pwd)
cd $SUBMODULE_PATH
ln -s $SUBMODULE_NAME/$SUBMODULE_NAME.js .
cd $GIT_DIRECTORY

## Add the .gitmodules and the link
git add .gitmodules $SUBMODULE_PATH/$SUBMODULE_NAME*
## Commit the new library
git commit -m "JavaScript,Libraries,$SUBMODULE_TAG: Adding $SUBMODULE_TAG @ $SUBMODULE_VERSION"

simple-static-boilerplate's People

Contributors

ekytr avatar

Watchers

 avatar

simple-static-boilerplate's Issues

Include libraries that require building

Some libraries (e.g. Angular.js) require running a build script.

Issue:
These can't be included as a submodule, because the repo doesn't have any dist files. We need to think of an elegant solution for including these libraries.

Potential solution:
We could create a Grunt Task to run the build script after npm install is completed, however it might just be simpler to add them as an npm dependency in that case.

Issues with solution:
It'd be nice not to have to rely on npm or Grunt for installing libs, because it seems silly for a boilerplate to an install process.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.