7

A simple yet powerful free webpack boilerplate to rapid prototyping and developm...

 4 years ago
source link: https://github.com/jomendez/simple-webpack-boilerplate
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Create web apps with Webpack

uqaau2m.png!web

A simple but powerful project to rapid prototyping and development of front-end apps, with scss (optional), pug (optional), ES7, webpack (bundlefy, uglyfy, etc). Very useful to create static websites or apps, without having to worry about setting up the environment.

You can get the source code free on Github

Features

  • Modern Technologies: Full support for HTML5, PUG, JavaScript (Vanilla and ES7) and CSS (Sass, scss and PostCSS)
  • Built-in Server: Local development server with live reloading
  • Performance Tuning: CSS and JavaScript transpilation, bundling, autoprefixing, and minification
  • Image Optimization: Optimizes images for loading speed
  • Favicon Generation: Automatically generates all favicons for Web, Apple and Android devices from one image file
  • Code Linting: Full support for JavaScript (ESLint) and CSS (StyleLint) linting
  • Setup Wizard: Optionally install helpful libraries and snippets including:
    • jQuery
    • Google Analytics
    • FTP deployment process
  • Cutting Edge: Uses Webpack for processing and bundling your code
  • Deployment: Built-in support for deployment via FTP

Requirements

Installation Steps

Clone repo:

git clone https://github.com/jomendez/simple-webpack-boilerplate && cd simple-webpack-boilerplate && 
rm -rf .git && git init
npm install
npm run setup

In this step you'll be able to setup your google analytics, enable jquery, setup (optional) an FTP for deployments.

6zuaQjj.png!web

npm run dev
npm run build
npm run deploy

If everything went well ( npm run dev )...

You browser should open a new tab and you should see something like this:

ZvQfyyb.png!web

Quick example

It is recommended to create a new page within the src folder or use the one that comes with the example page.pug to start adding your content.

byYnE3a.png!web

Then you can go to src/js/app.js file and add the following lines:

const page = require("../page.pug");
document.querySelector('container').innerHTML = page();

The code above is going to transpile the pug file this particular case (but it can be an html file). Then we will insert the content of the page into the container tag on the index.html.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK