• Stars
    star
    144
  • Rank 255,590 (Top 6 %)
  • Language SCSS
  • License
    MIT License
  • Created almost 8 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Web Starter Kit is an opinionated boilerplate for web development. A solid starting point for both professionals and newcomers to the industry.

Web Starter Kit

A modern Web starter kit for projects

node npm release SCSS travis license license readme requests

Overview

Web Starter Kit (WSK) - is an opinionated boilerplate for web development. Tools for building a great experience across many devices. A solid starting point for both professionals and newcomers to the industry.

Table of Contents

  1. Browser Support
  2. Features
  3. Install
  4. Quickstart
  5. Getting the code
  6. Prerequisites
  7. Commands
  8. Structure
  9. Templating
  10. Styles
  11. JavaScript
  12. Watching
  13. Images copy and minify
  14. Tasks
  15. Troubleshooting
  16. Contributing
  17. License

Browser Support

At present, we officially aim to support the last two versions of the following browsers:

  • Chrome
  • Edge
  • Firefox
  • Safari
  • iOS
  • ChromeAndroid

This is not to say that WSK cannot be used in browsers older than those reflected, but merely that our focus will be on ensuring our layouts work great in the above.

Features

Feature Summary
Easy start We don't use responsive boilerplate. You are free to make your own decision in what way to make responsive for the site. Just start with index.html from src/html.
HTML templating Used gulp-file-include for templating html files.
Sass support Compile Sass into CSS with ease, bringing support for variables, mixins and more (run npm run dev or gulp for project compiling). In our WSK we use Dart-Sass version compiler and follow Sass guidelines.
PostCSS support PostCSS connecting most usable plugins library for CSS optimisation. In our WSK we use autoprefixer, cssnano, postcss-sort-media-queries, etc.
JavaScript ES6+ Support Optional JavaScript ES6+ support .You can use all kind of ES6+ features here. ES6+ source code will be automatically transpiled to ES5 for wide browser support. For bundling and transpiling used Webpack and Babel.
Code Linting JavaScript code linting is done using esLint - a linter tool for identifying and reporting on patterns in JavaScript (used airbnb-base rules). HTML code linting is done using HTMLHint.
Performance optimization Minify and concatenate JavaScript, CSS, HTML and images to help keep your pages lean (run npm run dev or gulp to create an optimised version of your project to assets).
Built-in HTTP Server A built-in server for previewing your site locally while you develop and iterate.
Live Browser Reloading Reload the browser in real-time anytime an edit is made without the need for an extension (run npm run dev or gulp and edit your files).
Cross-device Synchronization Synchronize clicks, scrolls, forms and live-reload across multiple devices as you edit your project. Powered by BrowserSync (run npm run dev or gulp and open up the IP provided on other devices on your network).

Install

Init your project using jcn or directly download WSK.

To get started please run

$ npm install

if you want use Gulp in global context please run

$ npm install --global gulp && npm install

To take advantage of WSK you need to:

  1. Download the code.
  2. Install all necessary dependencies if you don't already have them.
  3. Modify the application as you wish.
  4. Make the production of your code.

This starter wasn't tested on Linux. If you want to use it on Ubuntu 17 type these commands in a command terminal:

$ sudo snap install node --classic --channel 6/stable
$ npm install gulpjs/gulp-cli -g

Quickstart

Init your project using jcn or download the kit from this repository and build on what is included in the assets directory.

You can start from src/html - the default starting point, with template text.

Be sure to look over the installation to verify your environment is prepared to run Web Starter Kit. Once you have verified that your system can run WSK, check out the commands available to get started.

Getting the code

Download and extract WSK to the place where you want to work.

Prerequisites

Node.js

Bring up a terminal and type node --version. Node should respond with a version at or above 10.0.x. If you need to install Node, go to nodejs.org and click on the big green Install button.

Gulp

Bring up a terminal and type gulp --version. If Gulp is installed it should return a version number at or above 4.0.x. If you need to install/upgrade Gulp, open up a terminal and type in the following:

$ npm install --global gulp

This will install Gulp globally. Depending on your user account, you may need to configure your system to install packages globally without administrative privileges.

Local dependencies

Next, install the local dependencies WSK requires:

$ npm install

That's it! You should now have everything needed to use the WSK.
You may also want to get used to some of the commands available.

Commands

There are few commands available to help you build and test sites:

Test

Test run with logs

$ npm run test

Development mode

Watch For Changes & Automatically Refresh Across Devices

$ npm run dev

dev creates the assets folder in the root of the project. This includes linting as well as image, script, stylesheet and HTML optimization. Also, a browsersync script will be automatically generated, which will take care of precaching your sites resources.

Build (production) mode

Serve the Fully Built & Optimized Site

$ npm run build

build creates the production folder in the root of the project with minifying files from assets. It will help you to create clear instances of code for the production or further implementation.

Lint for HTML

$ npm run lint-html

Lint & fix for JS

$ npm run lint-js

lint-js run the separate lint for JS files.
Included in dev and build.

$ npm run fix-js

fix-js run lint and auto-fix (eslint method) for JS files.
Not included in any mode.

Lint for HTML & JS

$ npm run lint

Structure

If you want to use our WSK, you need to know something about the structure.
Your folder structure for WSK:

β”œβ”€β”€ assets              #Folder with files after compiling
β”œβ”€β”€ helpers             #Folder with helpers function for tasks
β”œβ”€β”€ src                 #Folder with sources
β”œβ”€β”€ system_files        #Folder with system files
β”œβ”€β”€ tasks               #Folder with tasks for gulpfile
β”œβ”€β”€ .babelrc            #Config for Babel
β”œβ”€β”€ .browserslistrc     #Config for autoprefixer
β”œβ”€β”€ .editorconfig       #Config for IDE
β”œβ”€β”€ .eslintignore       #Eslint ignore list
β”œβ”€β”€ .eslintrc           #Config for eslint
β”œβ”€β”€ .gitattributes      #Git config for defining attributes per path
β”œβ”€β”€ .gitignore          #Git ignore list
β”œβ”€β”€ .htaccess           #Config file of Apache web service
β”œβ”€β”€ .travis.yml         #Config file of service for building and testing projects hosted at GitHub
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ gulp-config.js      #Config for gulp
β”œβ”€β”€ gulpfile.js         #File with gulp tasks
β”œβ”€β”€ LICENSE
β”œβ”€β”€ package.json        #File with dependencies
└── README.md

In package.json you can find all the dependencies. Folder tasks - for gulpfile tasks. In src folder you can find all sources for the project (images, html, sass, javascript files).

src folder structure

β”œβ”€β”€ html
   β”œβ”€β”€ partials                #Folder for html components, that we can include into the templates
   β”œβ”€β”€ templates               #Folder for source html templates of pages
β”œβ”€β”€ images                     #Folder for storing images
β”œβ”€β”€ js                         #Folder for storing js files
   β”œβ”€β”€ modules                 #Folder for storing js modules
   β”œβ”€β”€ app.js                  #Main js file
β”œβ”€β”€ scss
   β”œβ”€β”€ abstracts               #Folder for storing scss files
      β”œβ”€β”€ functions.scss       #Sass functions
      β”œβ”€β”€ helpers.scss         #Style helpers
      β”œβ”€β”€ main.scss            #Main file to import abstracts styles (used for importing another files)
      β”œβ”€β”€ mixins.scss          #Sass mixins
      β”œβ”€β”€ variables.scss       #Sass variables & CSS custom properties that we can use in project
   β”œβ”€β”€ base                    #Folder for storing base styles
      β”œβ”€β”€ forms.scss           #Styles for forms
      β”œβ”€β”€ main.scss            #Main file to import base styles (used for importing another files)
      β”œβ”€β”€ reset.scss           #Styles reset
      β”œβ”€β”€ typography.scss      #Styles for text
   β”œβ”€β”€ components              #Global Reusable Presentational Components
   β”œβ”€β”€ layout                  #Global layout
   β”œβ”€β”€ pages                   #Global styles for pages
   β”œβ”€β”€ styles.scss             #Main file to import project styles (used for importing another files)
β”œβ”€β”€ vendor_entries             #Folder for vendor entries (plugins)
   β”œβ”€β”€ vendor.scss             #File for plugins styles

Use images folder to add your graphic files, modules to add your javascript modules (don't forget to include it in app.js), scss folder to add your styles for the project. You can create, delete files and folders in scss, but don't forget to include them in scss/styles.scss file.

Use vendor_entries to include plugins into your project.

Templating

In our WSK you can use gulp-file-include for templating html files. It's simple, just see example or demo example in our WSK folder src/html.

For linting html files in WSK used HTMLHint.

Styles

In our WSK you can use Sass (Dart-Sass version compiler). Sass is the most mature, stable, and powerful professional grade CSS extension language in the world.

Sass is a CSS preprocessor β€” a layer between the stylesheets you author and the .css files you serve to the browser. Sass (short for Syntactically Awesome Style Sheets) plugs the holes in CSS as a language, allowing you to write DRY code that’ll be faster, more efficient, and easier to maintain. In our WSK we follow Sass guidelines.

So while normal CSS doesn’t yet allow things like variables, mixins (reusable blocks of styles), and other goodies, Sass provides a syntax that does all of that and moreβ€”enabling β€œsuper functionality” in addition to your normal CSS.

  • All custom sass files locate in src/scss/ folder;
  • Entry point is src/scss/styles.scss you can import all your .scss files from here;
  • All extensions must be installed by the npm;
  • After installing the extension you must include its css or sass files in src/vendor_entries/vendor.scss using @import.

You are able to add your own custom sass files and optionally disable/enable postcss-sort-media-queries. You can see this property getFilesForStylesCustom in the gulp-config.js file:

image

Please don't forget to link all your styles custom files in html file:

image

Also, you might want to add files to the ignore list (check getFilesToCopyProd and getFilesToCopy properties in the gulp-config.js file). By default they will be copied to the assets and production folders.

In our WSK you can use PostCSS. PostCSS is a tool for transforming CSS with JavaScript. Currently, PostCSS has more than 200 plugins. You can find all of the plugins in the plugins list.

  • You don't need to write prefixes for different browsers like -webkit it will be done by the autoprefixer.

In build (production) mode we use:

  • Group and sort CSS media queries by postcss-sort-media-queries. By default we use desktop-first sorting type, but you can change it in gulp-config.js to mobile-first.
  • Minifying .css files by cssnano.

In our WSK we use CSS3 custom properties and relative units rem. By default 1rem = 10px.

JavaScript

In our WSK you can use ES6+. ES6+ isn't introducing anything other than improvements to the JavaScript language and a few new features.

It is not an alternative syntax or language like CoffeeScript or TypeScript. It's good ol' fashioned JavaScript. The reason so many people are excited is that this version introduces a lot of much-needed improvements to the language.

For bundling and transpiling .js files in our WSK we used Webpack and Babel.

  • All custom javascript files are located in js folder;
  • Entry point for javascript is src/js/app.js you can import all your javascript files from here using ES6 import feature;
  • All javascript is babelified so yes! You can use all kind of ES6 features here.
  • All extensions must be installed by the npm;
  • All third party libraries from node_modules and src/vendor_entries, are automatically separate in vendor.js.

In build (production) mode we use:

For linting javascript files in WSK used esLint. esLint a linter tool for identifying and reporting on patterns in JavaScript (used airbnb-base rules) and some custom rules in file configuration .eslintrc.

Watching

After run gulp by default gulp watching for your files in src and assets folders. For js, scss, html and vendors_entries folders after change in included files, watcher run they tasks for compiling. For images and other folders (and files in src root) watcher run tasks for copy files & reload browser.

Images copy and minify

In our WSK by default in development and build (production) mode, task build-images only copy images.
For minify images used gulp-imagemin. If you want to minify your images in build (production) mode, please switch option buildImages.isImageMin = true in gulp-config.js.

Tasks

Task Description
browser-sync-server Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS & images) or will cause all browsers to do a full-page refresh.
build-html Compiles all html templates into html files.
build-js Compiles all js from src/js to assets/js folder. Automatically separate your code and vendors.
build-styles Compiles all scss from src/scss to assets/css folder.
build-styles-custom Compiles all custom scss files listed in the gulp-config.js to assets/css folder
build-styles-vendors Compiles all vendor styles from src/vendor_entries to assets/css folder.
clean-build Cleaning folders for output files.
copy-files Copy all not compiling files & folders from src to assets.
copy-files-production Copy all files & folders from assets to production.
lint-html Need to lint html files.
lint-js Need to lint & fix js files.
build-images We use this to copy images & minify for production.
watch Task for watching all the changes.

Troubleshooting

If you find yourself running into issues during installation or running the tools, please check our Troubleshooting guide and then open an issue. We would be happy to discuss how they can be solved.

Contributing

Contributions, questions and comments are all welcome and encouraged. For code contributions to Web Starter Kit, please see our Contribution guide before submitting a pull request. Website related issues should be filed on the Web Fundamentals issue tracker.

License

The MIT License (MIT).

Copyright (c) 2020 JustCoded the IP provided on other devices on your network.

More Repositories

1

wordpress-theme-boilerplate

WordPress theme boilerplace with improved classes-based code structure, theme wrapper and security patches
PHP
52
star
2

just-responsive-images

WordPress Plugin to support better responsive images with <picture> tag, backgrounds, retina support etc.
PHP
49
star
3

yii2-starter

Yii2 JustCoded Project Template
PHP
42
star
4

wordpress-starter

WordPress Project Template is a skeleton best for rapidly creating projects with modern development tools, easier configuration, and an improved folder structure.
PHP
31
star
5

wordpress-theme-framework

Lightweight MVC theming framework for developers who want to better organize their own custom themes with an MVC approach.
PHP
24
star
6

examples-scss-bem-code

Small website that was developed using SCSS and BEM methodology. Also we used our Web Starter Kit and Node.js modules to optimize images.
CSS
23
star
7

jquery-stars

jQuery "Magic" animation plugin
HTML
15
star
8

yii2-event-listener

Simple Event Listener component to register Listeners and Observers
PHP
12
star
9

form-handler

Validate simple html forms requests, send email notifications with ease. Best for pure HTML websites.
PHP
11
star
10

just-image-optimizer

WordPress plugin to compress image files, improve performance and boost your SEO rank using Google Page Speed Insights compression and optimization.
PHP
11
star
11

magento2-configurable-back-in-stock

Default product alerts in Magento 2 work only for the whole configurable products. This module allows customers to select specific configurations to get notified about
PHP
9
star
12

web-starter-kit-wp

Web Starter Kit is an opinionated boilerplate for web development inside the WP Theme. A solid starting point for both professionals and newcomers to the industry.
SCSS
6
star
13

dribbble-oauth2

Simple proxy server with NodeJS and ExpressJS that handles authorisation and gets an access token using our library
JavaScript
6
star
14

wp-host-update

Database migration tool for WordPress CMS
PHP
5
star
15

yii2-settings

Yii2 Settings Component with IDE autocompletion for setting keys, replace params.
PHP
4
star
16

npm-jcn

Command line tool for JustCoded company which allows to create starter boilerplate for different kind of projects.
JavaScript
4
star
17

vuejs-grid-filter

This module provides a filtered view of posts (or any kind of listing data), filtering/pagination/sorting should be realized on backend.
JavaScript
4
star
18

yii2-rbac

Yii2 RBAC Manager with nice graphic interface and advanced AccessFilter with automate route-based access
PHP
4
star
19

just-tinymce-custom-styles

WordPress Plugin to modify TinyMCE style_formats option
PHP
3
star
20

dotenv-sync

Avoiding problems with .env and .env.example files content mismatch.
PHP
3
star
21

animations-city

Web-page filled with animations which respond to the actions of users. The view of the city has many shifting details, so we chose a template which you’ll notice on the right hand side.
HTML
3
star
22

phpcodesniffer

PHP Code Sniffer custom rules pack
PHP
2
star
23

tutorial_shopify_nodejs_app

Example of shopify embedded app on node.js that introduced you with creating applications for shopify platform.
JavaScript
2
star
24

react-newsapi.org-app

News App based on the React Native framework that provides news from different countries and categories.
Objective-C
2
star
25

react.js-example

Web Application for booking meeting rooms using Google Calendar and based on the React.js library.
JavaScript
1
star
26

css3-vars-grid

CSS3 Variables Grid
CSS
1
star
27

magento-pci-auth

This module helps make Magento 1.x installation more PCI-compliant by controlling user password behavior.
PHP
1
star
28

yii2-morph

PHP
1
star
29

wordpress-composer-scripts

Custom Composer scripts for WordPress Project Template.
PHP
1
star
30

yii2-filestorage

Yii2 File Storage component, based on FlySystem. Use DB / morph relations to keep media library info.
PHP
1
star