A starter kit for HTML5 static website development with a congenial build process.
This repository could be used by anyone who's looking for a quick starter kit for static website development. This boilerplate uses Gulp for building and automating the workflow. Following are some key features we've included for you.
- Supports minification and concatination for production builds.
- The use of Sass: Syntactically Awesome Style Sheets over CSS.
- Ready to go build system using Gulp.
- Simplified development process with npm scripts.
- Ability to use your favorite bower packages.
- Organized easy to use folder structure for beginners.
| Demo |
|---|
The generated project have dependencies that require
nodetogether withnpm.
Make sure you have Node version >= 8.0 and npm >= 5 or Yarn.
# clone our repository
# --depth 1 removes all but one .git commit history
git clone --depth 1 https://github.com/brionmario/html-starter.git
# change the directory
cd html-starter
# install the dependencies
npm install
# start the development server
npm start
Once the dev server is fired up, it'll automatically open up a new tab. If not, navigate to http://0.0.0.0:3000 or http://localhost:3000 manually in your browser.
- File Structure
- Getting Started
- Configuration
- Styling
- Deployment
- Built With
- Contributing
- Contributors
- License
html-starter/
βββ coverage/ * unit test coverage reports
βββ dev/ * stores development build artifacts
βββ dist * stores production build artifacts
βββ docs/ * contains documents and document resources
βββ node_modules/ * contains dependencies pulled from npm
βββ src/ * source folder
β βββ assets/ * static assets such as images, icons, fonts goes here
β βββ bower_components/ * third party bower libraries will be copied here
β βββ sass/ * styles folder
β β βββ partials/ * place all the sass partial stylesheets in this folder
β β βββ styles.scss * the main stylesheet for the project which gets compiled to CSS
β βββ scripts/ * custom javascript script files
β βββ index.html * entry HTML file.
βββ .all-contributorsrc * contains info ablout repo contributors
βββ .babelrc * babel build config file
βββ .bowerrc * bower config file
βββ .buildpacks * contains heroku buildpacks
βββ .dockerignore * contains files that are ignored from docker
βββ .editorconfig * helps define and maintain consistent coding styles between different editors and IDEs
βββ .eslintrc * ecmascript linting configuration file
βββ .gitignore * contains files that are ignored from git
βββ .netlify.toml * netlify config file
βββ .npmrc * npm config file to house project wide custom configs
βββ .nvmrc * node version manager config file
βββ .pullapprove.yml * pullapprove config file
βββ .sass-lint.yml * sass linting configuration file
βββ .travis.yml * travis ci configuration file
βββ app.json * heroku manifest format for describing app
βββ bower.json * contains bower dependencies
βββ CONTRIBUTING.md * project contributing guidelines
βββ docker-compose.yml * docker compose file
βββ Dockerfile * docker config file
βββ gulpfile.babel.js * main buld configuration file. contains all the gulp tasks.
βββ LICENSE.md * licensing information
βββ package.json * contains all the npm scripts for building, running, deploying etc. and contains all the dependencies
βββ Procfile * contains commands to be executed by heroku at app startup
βββ README.md * Readme file for the repository
What you need to run this app:
- The generated project have dependencies that require
Node.jstogether withnpm.
Make sure you have
Node.jsandnpminstalled by running the following simple commands on the command line and see if you're running the latest stable versions.
- Node.js - Type
node -von the terminal. - npm - Type
npm -von the terminal.
If you do not have them installed, click here and grab the latest stable version of node and npm will be automatically installed along with it. Or if you have brew already installed in your local machine, execute brew install node command to get node.
The project requires bower to install project scope dependencies such as bootstrap, jquery etc. but it is not required to install bower on your local machines since npm installs bower as a project dependency. Also bower install command is run automatically by npm as a post install script.
In addition we've created npm scripts to run gulp tasks and gulp is installed by npm as a project depency. So you don't have to install gulp or gulp cli manually on your working machine.
clonethe repositorycd html-starterto change the directorynpm installto install the dependencies with npm (installs bower dependencies as well using a post install script)
After you have installed all dependencies you can now run the app. Run npm start to start a local server using gulp which will watch your stylesheets and javascript files for changes, compile, minify, build and reload the browser automatically using browser-sync library.
The dev server will be opened in a new tab and usually on http://localhost:3000 and the Access URLs will be displayed on the terminal.
# development
npm start
# production
npm run server:prodThe gulp tasks are defined inside the gulpfile.babel.js file found on the root of the application and you need to extend this file if you want to customize the application.
To use any third party bower libraries other than the included jquery-mobile, jquery and font-awesome libs, locate the package you want in the bower package repository and use the following command to add it to your project.
bower install $package --saveTake a look at the bellow example:
Lets say that you want to add moment.js to your project. Just run the command bellow.
bower install moment --saveNOTE: Some packages won't work as expected and you might have to do overrides in the bower.json file.
The styles.scss file inside the sass directory is the main stylesheet for the project and will be compiled and minified into an external .css and is embedded in the index.html file.
If you want to add your own stylesheet, we recommend that you place it under the scss/partials folder and import it in the styles.scss file.
For example if you want to include the styles for a slider:
- Create a
_slider.scsspartial file in thescss/partialsdirectory. - In
styles.scssadd@import 'partials/slider.scss';
Execute the following command to run your unit tests. We use codecov package to generate test coverage reports and the generated reports can be found in the coverage folder.
npm run testExecute the following commands to generate linting for styles and scripts.
# all
npm run lint
# javascript
npm run lint:scripts
# sass
npm run lint:stylesExecute the following command to build your files in the development mode. A new folder called dev will be created and the artifacts will be saved there.
npm run build:devExecute the following command to build your files in the production mode. A new folder called dist will be created and the artifacts will be saved there.
npm run buildDeploy to Heroku using this template with one single click. Heroku has an awesome free plan and it is extremely easy to use.
Click here to see the deployed app.
Deploy to Netlify using this template with one single click. It has an awesome free plan and a nifty CLI which makes the deployment process much easier.
Click here to see the deployed app.
Please read CONTRIBUTING.md for contributing guidelines and to learn about our code of conduct.
Thanks goes to these wonderful people (emoji key):
Brion Mario π» π π |
|---|
This project follows the all-contributors specification. Contributions of any kind welcome!
This project is licensed under the MIT License - see the LICENSE.md file for details.