Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

nikcio/Nikcios-toolkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gulpfile.js documentation

  • Gulp version: 4.0.2
  • Package version: 1.3.0
  • Last updated: May 2020

Requires:


Install gulp:


npm install gulp-cli -g

Setup:


1. Run

npm install

2. Modify package.json

{
   "name": "Nikcios-toolset",
   .
   .
   .
   "repository": {
   "type": "git",
   "url": "git+https://github.com/AUTHOR/PROJECT_NAME.git"
   },
   .
   .
   .
   "bugs": {
      "url": "https://github.com/AUTHOR/PROJECT_NAME/issues"
   },
   "homepage": "https://github.com/AUTHOR/PROJECT_NAME#readme"
}

Consider changing these settings before usage.

3. Start using gulp

gulp

Features


  • SASS formatting (minification + auto-prefix)
  • JavaScript formatting (minification + concat)
  • HTML style and JavaScript injecting
  • Automatic browser synchronization
  • Image minification
  • SVG formatting (minification + concat) - Out of order
  • Copy video and fonts

How to change the file structure


To change the structure of the src folder or the dist folder visit the gulp-config.js

Here all the paths are shown and can be changed to your liking.

File structure in folders


src
    > assets
        > img
           > 350x150.png
        > fav
           > favicon.ico
    > js
        > nav.js
    > sass
        > _nav.scss
        > _footer.scss
        > base.scss
    > html
        > index.html

dist
    > css
    > img
    > scripts
    > svg
    > video
    index.html

Commands


  • gulp
    • This is the default command and runs every command in the correct order and ends on a watch which watches all file changes and operates accordingly
  • gulp dev
    • Does the same as the default command
  • gulp svg
    • Runs the SVG formatting
  • gulp clean
    • Cleans the dist folder
  • gulp sassFormat
    • Runs the SASS formatting
  • gulp images
    • Runs the image formatting
  • gulp video
    • Copies videos
  • gulp fonts
    • Copies fonts
  • gulp JSFormat
    • Runs the JavaScript formatting
  • gulp injectToHTML
    • Injects styles and JavaScripts into the HTML files
  • gulp serve
    • Starts a browser-sync instance
  • gulp watch
    • Starts a watch of all the files in src
  • gulp reload
    • Reloads the browser-sync instance

Change browser support


This tool uses browserslists to define browser support which can be changed form the package.json file

To change the support just change the "defaults" tag under browserslist:

"browserslist": [
    "defaults"
  ]

How to inject files

To inject a html partial just the following function after creating the file inside your partial directory:

<!-- inject:partial:partials/htmlfile.html -->
<!-- endinject -->

How to use SASS

When using SASS you can decide which files should be copied by typing a underscore before files that should now be copied.

Help


I cannot run any commands:

If you're getting an error saying you don't have permission to run scripts run this command in your PowerShell
  • Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

I'm reinstalling an existing project and have errors:

When reinstalling delete the `package.json-lock` and the `node_modules` folder then run `npm install`.

Packages

 
 
 

Contributors