2.8.0-beta4 ā€¢ Published 4 years ago

@afuggini/generator-frontend v2.8.0-beta4

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@afuggini/generator-frontend

Build Status

We aim to generate a boilerplate code for projects when we know the specs. šŸ’•

How to install

Node

You will need node installed in your machine. In case you don't have it (you can check this typing node --version in your terminal) please visit this link.

We also need to install Yeoman, and the Pixel2HTML Generator, so run this command in your terminal. The -g parameter is to install them globally so can use it in every project.

$ npm install -g yo @afuggini/generator-frontend

Running the generator

To generate the Pixel2HTML Boilerplate go to your project folder and run this command in your shell

$ cd ~/your/project/folder
$ yo @pixel2html/frontend

The Pixel2HTML Boilerplate will ask you questions about this points. Answering with the desired options will generate the code.

  • Project Name?
  • Quantity of screens?
  • Markup Language? Options: HTML / Pug
  • Frontend Framework Options: None / Bootstrap 3.*/ Bootstrap 4 Beta / Foundation
  • jQuery? Options: true / false

There are also two more way to generate your files, you can find the instructions in the Wiki

Installing dependencies & running up

To work, the Pixel2HTML Boilerplate needs to install some dependencies to run the options you select. For this job, run this command in your shell

$ npm run start

Generated file structure

This boilerplate will create a set of files and folders

ā”œā”€ā”€  dist/
ā”œā”€ā”€  gulp/
ā”œā”€ā”€  src/
ā”‚    ā””ā”€ā”€  assets/
ā”‚    ā”‚    ā”œā”€ā”€  fonts/
ā”‚    ā”‚    ā”œā”€ā”€  icons/
ā”‚    ā”‚    ā”œā”€ā”€  images/
ā”‚    ā”‚    ā”œā”€ā”€  js/
ā”‚    ā”‚    ā”œā”€ā”€  styles/
ā”‚    ā”‚    ā”‚    ā”œā”€ā”€  components/
ā”‚    ā”‚    ā”‚    ā”‚    ā”œā”€ā”€  _buttons.scss
ā”‚    ā”‚    ā”‚    ā”‚    ā”œā”€ā”€  _forms.scss
ā”‚    ā”‚    ā”‚    ā”‚    ā””ā”€ā”€  _nav.scss
ā”‚    ā”‚    ā”‚    ā”œā”€ā”€  screens/
ā”‚    ā”‚    ā”‚    ā”‚    ā”œā”€ā”€  _base.scss
ā”‚    ā”‚    ā”‚    ā”‚    ā””ā”€ā”€  screen_*.scss
ā”‚    ā”‚    ā”‚    ā”œā”€ā”€ _mixins.scss
ā”‚    ā”‚    ā”‚    ā”œā”€ā”€ _reset.scss
ā”‚    ā”‚    ā”‚    ā”œā”€ā”€ _variables.scss
ā”‚    ā”‚    ā”‚    ā”œā”€ā”€ main.scss
ā”‚    ā”‚    ā”‚    ā””ā”€ā”€ vendor.scss
ā”‚    ā””ā”€ā”€  screen_*.[html|pug]
ā”œā”€ā”€  .editorcofig
ā”œā”€ā”€  .gitattributes
ā”œā”€ā”€  .gitignore
ā”œā”€ā”€  .project.conf
ā”œā”€ā”€  gulpfile.js
ā”œā”€ā”€  package.json
ā””ā”€ā”€  README.md

How to work with script files

We are using WebpackJS to bundle our script files. There's also ES6 on-demand transpilation and polyfills.

Learn more about Javascript Modules here Wes Bos Article About Modules

Example

import $ from 'jquery'
import 'bootstrap-sass'

We also included the amazing webpack-bundle-analyzer you can fine tweak you JS bundle size if you wish to. Fire it up running this command:

$ npm run debug

Available script commands.

Start to code.

  • $ npm run code

Build the project

  • $ npm run build

Available Gulp Commands

Helpers

  • $ gulp clean Clean /dist directory

Static Files

  • $ gulp main:static Compile static files (images, icons)
  • $ gulp main:images Move images
  • $ gulp main:icons Move icons

Fonts Files

  • $ gulp main:fonts Move project fonts
  • $ gulp vendor:fonts Move vendors fonts

Scripts

  • $ gulp main:scripts Concat, uglify and move project JS files
  • $ gulp vendor:scripts Concat, uglify and move vendors JS files

Styles

Delivery

  • $ gulp build Execute all the gulp directives and makes a .zip file with the latest code.
  • $ gulp release Execute all the gulp directives and makes a .zip file with the latest code.
  • $ gulp release --prod Execute all the gulp directives, prepare assets to production and makes a .zip file with the latest code.