lecoueyl / weaverjs

[DEPRECATED] Create static web page straightaway. Use the best of nodejs to build the sharpest html, css and javascript

Home Page:https://lecoueyl.github.io/weaverjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weaverjs | Web starter kit

Weaverjs is an opinionated boilerplate for web development based on Gulp, Node, NPM, Sass and Pug.

It helps you by automating website builds and lets you focus on writing only reusable modules for html, css and javascript. You can visit the repository of Weaverjs's homepage to have an usage example.

Note: Weaverjs is a guideline and it doesn't solve everything. It is up to you to modify whatever is necessary to achieve your project goals and dreams.

Table of Contents

Quickstart

npm cache clear && npm i && npm run gulp

Note: In order to install packages, you will need to install Node and NPM. It’s recommended to use nodenv to manage them

Directory Layout

├── /dist/                        # The compiled output (generated by Gulp)
├── /src/                         # Application source files
│   ├── fonts/                    # Asset folder for fonts
│   ├── images/                   # Asset folder for images (jpg, png, ...)
│   ├── media/                    # Asset folder for media (mp4, webm, ...)
│   ├── misc/                     # Miscellaneous files for the root folder (favicon.ico, robots.txt, ...)
│   │   ├── all/                  # Miscellaneous files for all environments
│   │   ├── development/          # Miscellaneous files for development only
│   │   ├── production/           # Miscellaneous files for production only
│   │   └── staging/              # Miscellaneous files for staging only
│   ├── scripts/                  # Javascripts files
│   │   ├── components/           # Javascripts components files to be included
│   │   └── main.js               # Main Javascripts files
│   ├── styles/                   # Scss styles files
│   │   ├── base/                 # Base styles are the default styles of base elements.
│   │   ├── components/           # UI elements
│   │   ├── objects/              # Class-based selectors which define undecorated design patterns
│   │   ├── settings/             # Setting files contain global configurations that are shared by more than one modules
│   │   ├── tools/                # Specific style for each views
│   │   ├── utilities/            # High-specificity explicit classes
│   │   └── main.scss             # Global scss style file
│   ├── svg/                      # Asset folder for svg files
│   ├── vendors/                  # Vendors Javascripts files (jquery, ...)
│   │   ├── bundle.js             # Non minimized vendors Javascripts files (for development)
│   │   └── bundle.min.js         # Minimized vendors Javascripts files
│   └── views/                    # Pug included files
│       ├── extends/              # Pug view files
│       ├── includes/             # Pug reusable components
│       ├── mixins/               # Sets of pug mixins and functions.
│       └── site/                 # Pug view files
├── .node-version                 # Specific node version for nodenv
├── gulpfile.js                   # Gulp configuration
└── package.json                  # Project dependencies

Build

npm run build

Generate a fresh build of your project. Task will run several individual tasks on files within ./src and then output them to ./dist.

Environments

You can specify which environment you want to build. Development environment is used by default when building with no option.

Development

npm run dev

Stage

npm run stg

Production

npm run prd

Server

Start a local dev server. Additionally, gulp will watch for any change on files and reload the browser while the server is running.

npm run gulp server

Deploy

Github Pages

If you want to host your site on Github Pages, you can deploy directly a production version on the gh-pages branch. Therefore, you have to commit at least once your project on a Github repository.

npm run github

Local URLs

Options

You can modify port, proxy, and many other settings in ./gulpfile.babel.js. For more information about BrowserSync go to http://www.browsersync.io.

Assets

Run several individual tasks to copy static files from ./src to ./dist.

npm run gulp assets

Fonts

Copy font files to ./dist/fonts.

npm run gulp fonts

Images

npm run gulp images

Copy images to ./dist/images. As a personal preference Weaverjs doesn't use automated image optimization. It is strongly recommended to use services like TinyPNG and TinyJPG to optimize images manually.

Media

npm run gulp media

Copy media files to ./dist/media.

Miscellaneous

Copy miscellaneous files, such as .htaccess or robots.txt, to the root of ./dist. If your project require custom settings per environment, then you can save individual files into the appropriate directory within ./src/misc.

npm run gulp misc

Vendors

npm run gulp vendors

Bundle vendor files to ./dist/vendors. You can install new client-side vendors using npm, then reference appropriate files in ./src/vendors/bundle.js and ./src/vendors/bundle.min.js.

Jquery example

Add jquery package in package.json

"dependencies": {
  ...
  "jquery": "^x.x.x",
  ...
}

Reference it for development in ./src/vendors/bundle.js

// =include jquery/dist/jquery.js

And for minified version in ./src/vendors/bundle.min.js

// =include jquery/dist/jquery.min.js

Scripts

npm run gulp scripts

Run a series of sub-tasks to generate final JavaScript files.

Note: Each file on the root of ./src/scripts will be compiled into its own file in ./dist/scripts. Each file can have its own includes, just like Sass with @import functionality. See ./src/scripts/main.js as an example.

Styles

npm run gulp styles

Run a series of sub-tasks to generate final CSS files. See ./gulpfile.babel.js for reference.

Note: Each file on the root of ./src/styles will be compiled into its own file in ./dist/styles.

iotaCSS

Weaverjs use iotaCSS SASS based OOCSS framework built for scale.

Views

npm run gulp views

Run a series of sub-tasks to generate final HTML files. See ./gulpfile.babel.js for reference.

Pug Structure

Weaverjs follows an opinionated directory structure. To learn more about Pug go to https://pugjs.org/api/getting-started.html/.

Environment Variables

Every Pug file has access to the global env variable. You can use it to conditionally load unminified/minified assets. See ./src/views/includes/head.pug as an example.

Contributing

  1. Create a personal fork of the project on Github.
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Inspiration

Weaverjs is inspired by web-starter-kit-gulp by @KrisOlszewski

About

[DEPRECATED] Create static web page straightaway. Use the best of nodejs to build the sharpest html, css and javascript

https://lecoueyl.github.io/weaverjs.com

License:MIT License


Languages

Language:JavaScript 80.3%Language:HTML 16.8%Language:CSS 2.9%