GithubHelp home page GithubHelp logo

quatrocode / simplr-gulp Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 0.0 1.21 MB

Fully functional gulpfile.js implementation. Tailored for Single Page Application. Written in TypeScript

License: GNU Affero General Public License v3.0

JavaScript 45.21% TypeScript 54.44% CSS 0.06% HTML 0.29%
simplr-gulp gulp subtask nodejs typescript

simplr-gulp's Introduction

simplr-gulp

NPM version Build Status dependencies Status devDependencies Status peerDependencies Status

I just want to use gulpfile.js

  1. Install simplr-gulp in your project:
npm install simplr-gulp --save-dev
  1. Create gulpfile.js in your project root directory:
require('simplr-gulp');
  1. Start command:
gulp -T

Which will show all available commands.

All directories, server and live-reload settings are configured in gulpconfig.json.

After first run, gulpconfig.json file will be generated for you to edit for your own use.

Requirements

Available commands

Gulp tasks

  • default - start Watch task with server.

  • Build - compiles source files with development environment (starts all Build.* subtasks)

    • Build.Assets - copies all assets folders and their contents from source to build directory
    • Build.Configs - copies configs folder from source to build directory with jspm environment
      • Build.Configs.Files - copy jspm.config.js file from source to build directory with production environment (production only)
      • Build.Configs.Folders - copies configs folder from source to build directory
    • Build.Html - copies all *.html files from source to build directory
    • Build.Scripts - compiles TypeScript with sourcemap from source to build directory
      • Build.Scripts.Typescript - compiles TypeScript with sourcemap from source to build directory
      • Build.Scripts.Tslint - check for tslint warnings
    • Build.Styles - compiles *.scss files from source to build directory
  • Build:Production - compiles, minifies and uglifies source files with production environment (starts all Build.*:Production subtasks)

    • Build.Assets:Production - copies all assets folders and their contents from source to build directory
    • Build.Configs:Production - copies web.config (for Asp.Net 5 projects) and configs folder from source to build directory
    • Build.Html:Production - copies all *.html files from source to build directory
    • Build.Scripts:Production - compiles TypeScript from source to build directory
      • Build.Scripts.Typescript:Production - compiles TypeScript from source to build directory
      • Build.Scripts.Tslint:Production - check for tslint warnings
    • Build.Styles:Production - compiles and minifies *.scss files from source to build directory
  • Watch - watch source files, start tasks (all Watch.* subtasks) and call live reload action.

    • Watch.Assets - start task Build.Assets
    • Watch.Configs - start task Build.Configs
    • Watch.Html - start task Build.Html
    • Watch.Scripts - start task Build.Script
    • Watch.Styles - start task Build.Styles

Watch.* subtasks available only at runtime.

  • Bundle - bundles the app with jspm bundle with development environment

  • Jspm.CdnPaths:Production - Generate CDN paths (https://cdnjs.com) into src/configs/jspm.config.production.js using npm registry

  • Clean - cleans build directory (wwwroot by default) without wwwroot/libs folder and wwwroot/**/.gitkeep files

    • Clean.All - cleans build directory (wwwroot by default) without wwwroot/**/.gitkeep files
    • Clean.Bundle - remove build file (build.js by default) from build directory (wwwroot by default)
    • Clean.Libs - cleans libs directory (wwwroot/libs by default)

Trying it yourself

  1. git clone https://github.com/QuatroCode/simplr-gulp.git
  2. cd simplr-gulp/example
  3. npm install
  4. jspm install
  5. gulp
  6. Go to http://localhost:4000

Default gulpconfig.json (can be customized)

{
    "Directories": {
        "Source": "src",
        "Build": "wwwroot",
        "App": "app"
    },
    "TypeScriptConfig": {
        "Development": "tsconfig.json",
        "Production": "tsconfig.production.json"
    },
    "ServerConfig": {
        "Ip": "127.0.0.1",
        "Port": 4000,
        "LiveReloadPort": 4400
    },
    "BundleConfig": {
        "AppFile": "app.js",
        "BuildFile": "build.js",
        "Include": [],
        "Exclude": [
            "[app/**/*]"
        ]
    },
    "WebConfig": null,
    "CfgVersion": 2.02
}

More info about configuration

Development

Prerequisites

You need global npm packages (gulp, typings, jspm, rollup):

  1. npm install gulp-cli -g
  2. npm install typings -g
  3. npm install jspm -g
  4. npm install rollup -g

If you want to update simplr-gulp package yourself

  1. git clone https://github.com/QuatroCode/simplr-gulp.git
  2. cd simplr-gulp
  3. npm install
  4. typings install
  5. builder.bat -watch:sample
  6. Make changes

builder.bat available commands

builder.bat -build	            # build code to /dist
builder.bat -build:sample	    # build code to /example
builder.bat -watch	            # build and start watcher to /dist
builder.bat -watch:sample	    # build and start watcher to /example

License

AGPL-3.0

Hyperlinks

simplr-gulp's People

Contributors

dovydasnavickas avatar giedriusgrabauskas avatar martynaszilinskas avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

simplr-gulp's Issues

Roadmap

Roadmap

  • Minify .js files
  • Remove WebConfig from gulpconfig.json
  • Add more features in gulpconfig.json
    • Set uglify options
    • Set styles autoprefixer options
    • Set Bundle config (uglify, minify)
    • TsLint configuration
      • Use TsLint (true/false)
      • Custom TsLint config file name
      • Output errors types
    • CSS minification config
  • Remove zero number limt in Helpers.Pad() function
  • Handle if file already copied (Build.Assets, Build.Configs)
  • Update Typescript definitions
  • Files structure
    • Localhost server with live reload
    • Modules or plugins (?)
  • Watchers tasks handler
    • Handle unlink event for deleted folders
  • Localhost server
    • Live reload react rerender
  • Create 'Clean.Libs' task (Moved to Release 2.1.0)
  • Don't read package.json on start (return Promise).

[Jspm.CdnPaths:Production] Cannot resolve moment.js

Package: http://momentjs.com/

[17:06:24] INFO JSPM [npm:moment@2.14.1]: Downloading https://api.cdnjs.com/libraries?fields=assets%2Cversion&search=moment
[17:06:25] INFO JSPM [npm:moment@2.14.1]: Response 200 (OK).
[17:06:25] INFO JSPM [npm:moment@2.14.1]: Downloaded and parsed 12 results.
[17:06:25] WARNING JSPM [npm:moment@2.14.1]: Cannot resolve cdn link with version 2.14.1.

[Jspm.CdnPaths:Production] react-dom resolve wrong file

react-dom resolved with not minified file (react-dom.js).

[17:06:11] INFO JSPM [npm:react-dom@15.2.1]: Downloading https://api.cdnjs.com/libraries?fields=assets%2Cversion&search=react-dom
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Response 200 (OK).
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Downloaded and parsed 0 result.
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Trying to use splited package name: react
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Downloading https://api.cdnjs.com/libraries?fields=assets%2Cversion&search=react
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Response 200 (OK).
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Downloaded and parsed 78 results.
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Not targeting the latest version 15.3.0, trying to find version 15.2.1
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Version 15.2.1 found.
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: File react-dom.js found.
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: Cdn link successfully resolved.
[17:06:12] INFO JSPM [npm:react-dom@15.2.1]: https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.js

Typescript error

Unhandled typescript error:

ERROR TS: src\app\routes\start\start-route.tsx[19, 7]:  { messageText: 'Class \'StartRoute\' incorrectly extends base class \'Component<Props, State>\'.',
  category: 1,
  code: 2415,
  next:
   { messageText: 'Property \'state\' is private in type \'StartRoute\' but not in type \'Component<Props, State>\'.',
     category: 1,
     code: 2325,
     next: undefined } }

JSPM install fails

When following instructions from the read-me, error occurs while trying to install JSPM dependencies by running "jspm install".
Error details below:

err Registry quatrodev not found.
err Unable to load registry quatrodev
warn Installation changes not saved.

Missing dependencies

When trying to run :build for the first time, gulp dependency missing:
gulp-sourcemaps

Typescript error handler

ERROR TS: src\app\app.ts[12, 17]: [object Object] 
ERROR TS: undefined[14569, 6]: Duplicate identifier 'AlgorithmIdentifier'. 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.