Detalhes do pacote

simpless

royriojas137MIT3.1.0

yet another less wrapper with some preconfigured plugins, less-plugin-glob, autoprefixes, and a very useful watch mode

less compiler, css concact, move relative resources to the output folder

readme (leia-me)

NPM Version Build Status

simpless

simpless is yet another less wrapper. This one will:

  • parse your less files
  • allow you to include several files using less-plugin-glob
  • inline small url files into the output css file
  • copy the urls that cannot be inlined to a folder relative to the output
  • provide the option to include a banner
  • provide the option to pass a revision number
  • generate the minimized version if required
  • provide the option to include custom functions. calc-em, calc-rem and rel-val are included as an example of how to add custom functions. the code is simpless/lib/default-user-fns.js. It is intented to be a guidance of how to add this functions to less.

TODO: Add a cache mode for incremental builds

NOTE: The module used to have colored output. It has being removed because not all terminals use the same color scheme. --colored-ouput can be used to get the colored output back

Motivation

Just wanted to have a good wrapper to process my less resources, without having to manually install all of the dependencies. Also the watch mode was something I really need to have. All the other solutions were only listening on the main entry file but if an imported file changed, then I was lost. I know I can use gulp-progeny or something similar to achieve the same, but I didn't wanted to depend on a task runner. I'm trying to embrace the npm as build tool approach. This module is helping now to get some sanity to my building process and hope it can help others as well.

Install

npm i -g simpless

Usage

here is the output of the --help option

`simpless` is yet another less wrapper. This one will:

- parse your `less` files
- allow you to include several files using `less-plugin-glob` `@import "some/glob/**/*.less"
- inline small url files into the output css file
- copy the urls that cannot be inlined to a folder relative to the output
- provide a watch mode to rebuild the css on any change of the entry file and any of its dependencies
- will make you happy!. Well maybe, at least I hope it will do its best effort!

========================================================
Usage: simpless [options] glob [glob1] [glob2]..[globN]
========================================================

Options:
  -b, --browsers [String]      the browsers to autoprefix. Default is `last 2 browsers`
  -a, --advance-min            Whether or not to apply more risky structural optimizations for CSS. By Default is `false`. Use it with care. Requires
                               --minimize
  -c, --copy-assets            Copy the assets to the destination folder. By default is `true` - default: true
  -p, --assets-path-format String  The format of the assets rewrite path. By default is `assets/{REVISION}_{GUID}_{FNAME}` where {REVISION} is the revision
                                   passed to the command, {GUID} the unique indetifier or the resource and {FNAME} the filename.
  -m, --minimize               Whether to minimize or not the output or not. By default is `false`. When the flag is set both the non minimified and
                               minified versions will be created
  -w, --watch                  wait for changes on the files and dependencies to rebuild the target
  -d, --watch-delay Number     Amount of time in milliseconds to wait before emitting an "update" event after a change - default: 600
  -o, --output String          The path and name for the output file
  -r, --revision String        The revision to use in the file names and assets, for example the build number or other number to identify this resource
  --banner String              The banner to put at the top of the compiled files
  -u, --user-functions String  the path to the user functions module. A simple object where each key is the name of the function and the value is the custom
                               function itself
  -h, --help                   Show this help
  -v, --version                Outputs the version number
  -q, --quiet                  Show only the summary info - default: false
  --colored-output             Use colored output in logs

Examples

# this will compile demo.less and other-file.less into out.css
simpless src/demo.less src/other-file.less -o dest/out.css

# this will compile demo.less and other-file.less into out.css
# and generate out.min.css also
simpless src/demo.less src/other-file.less -o dest/out.css -m

# this will compile demo.less and other-file.less into out.css
# and generate out.min.css using structure modifications. Use it with care.
simpless src/demo.less src/other-file.less -o dest/out.css -ma

# this will compile demo.less and other-file.less into out.1.5.3.css
# and generate out.1.5.3.min.css using structure modifications and a revision value
simpless src/demo.less src/other-file.less -o dest/out.css -ma -r 1.5.3

# this will compile demo.less and other-file.less into out.1.5.3.css
# and generate out.1.5.3.min.css using structure modifications and a
# revision value and set the browsers to use autoprefix to `last 1 version`
simpless src/demo.less src/other-file.less -o dest/out.css -ma -r 1.5.3 -b 'last 1 version'

# generate a file with a banner, both normal and minified.
simpless -o demo/dest/demo.css demo/src/demo-with-fns.less --banner="/*! some license info for the generated file */" -ma

# use some custom functions defined in an external module
simpless -o demo/dest/demo.css demo/src/demo-with-fns.less -ma -u './path/to/custom-functions';

# generate the combined output of demo.css and demo-with-fns.less using --colored-ouput and a delay of 250ms
simpless -w -o demo/dest/demo.css demo/src/demo.less demo/src/demo-with-fns.less --colored-output -d 250

# Same as above but include customFunctions js file
simpless -u lib/default-user-fns.js -w -o demo/dest/demo.css demo/src/demo.less demo/src/demo-with-fns.less --colored-output -d 250

Changelog

changelog (log de mudanças)

simpless - Changelog

v3.1.0

  • Build Scripts Changes
    • Fix possible memory leak issue when using process.on - 762eec7, Roy Riojas, 09/02/2016 23:14:39

v3.0.16

  • Enhancements
    • do not read from file if the content is provided - 9b2dfdc, royriojas, 20/11/2015 13:57:05

v3.0.15

  • Bug Fixes
    • grunt task cannot override generation of minimized file - cce23f4, royriojas, 15/09/2015 19:53:10

v3.0.14

  • Bug Fixes
    • properly throw errors during path rewriting - 7cd83ca, royriojas, 28/08/2015 14:35:18

v3.0.13

  • Bug Fixes
    • make sure watcher honor the changes on imported files - 7515364, royriojas, 25/08/2015 12:54:30

v3.0.12

  • Enhancements
    • Do not break the tasks if an error happen in one target - 0ac4f26, royriojas, 21/08/2015 17:36:37

v3.0.11

  • Enhancements
    • Properly handle errors thrown during parsing less file - 7a76f95, royriojas, 21/08/2015 17:27:49

v3.0.10

  • Build Scripts Changes
    • Update clix to obtain ext and rename options - f483153, Roy Riojas, 21/08/2015 01:42:40

v3.0.9

  • Build Scripts Changes
    • include latest clix to fix issue expanding mappings - fe08d98, Roy Riojas, 20/08/2015 23:16:41

v3.0.8

  • Bug Fixes

v3.0.7

  • Features
    • allow to specify more than on task to run at a time - 7f3d7cf, royriojas, 17/08/2015 02:06:31

v3.0.6

  • Refactoring
    • Add support for grunt style configuration file - 2a7f697, royriojas, 16/08/2015 19:57:21

v3.0.5

v3.0.4

  • Build Scripts Changes
    • update clix dep to get nicer log output - 8533d35, royriojas, 11/08/2015 17:41:59

v3.0.3

v3.0.2

v3.0.1

  • Bug Fixes

v3.0.0

  • Refactoring
    • rename copy-assets-to option to copy-assets - b3dbde1, royriojas, 09/08/2015 16:50:37
  • Build Scripts Changes
    • Update clix dependency to get better log messages - b89173d, royriojas, 09/08/2015 16:49:31

v2.0.7

  • Build Scripts Changes
    • update dependencies and build script - f33039e, royriojas, 07/08/2015 15:09:02
  • remove modules that are devDependencies from the dependencies section - 0680caf, royriojas, 07/08/2015 14:35:16

v2.0.6

  • Build Scripts Changes

v2.0.6-0

  • Build Scripts Changes
    • Upgrade to 2.0.6-0 to try the less compiler from the branch with faster compile time - a64f72f, royriojas, 22/07/2015 14:22:00
  • Add less from the branch to speed up compile time - 58ec719, royriojas, 22/07/2015 14:04:45

v2.0.5

  • Build Scripts Changes

v2.0.4

v2.0.3

  • Refactoring
    • remove not needed call to util inspect - eced4d1, royriojas, 13/07/2015 00:10:44
  • Bug Fixes
    • Proper error reporting of the file causing the parse issue from less - c9eab6e, royriojas, 13/07/2015 00:10:15
  • Updated clix dep for the ability to set the colored output flag using an environment flag - 417dda0, royriojas, 12/07/2015 23:44:24

    In your profile add the following line to have the colored output back without having to specify the flag --colored-output

    export __CLIX_COLORED_OUTPUT__=true
    

v2.0.2

  • Documentation
    • fix issue with the style of the readme - 0c30c0a, royriojas, 12/07/2015 01:55:35

v2.0.1

  • Build Scripts Changes
    • Include a script to automate the changelog generation - cfb6cee, royriojas, 12/07/2015 01:48:21
  • Bug Fixes
    • include default user functions again, removed by mistake - 34e6b1a, royriojas, 12/07/2015 01:47:58

v2.0.0

  • Documentation
    • Add some notes about the lack of colored output - d79bd27, royriojas, 12/07/2015 01:43:39
  • Features

    • Add watch mode to simpless - 8fb4ca4, royriojas, 12/07/2015 01:41:29

      The watch mode works by setting listeners on:

      • the entry file
      • the referenced files (by using url() in the css properties) this is currently done by using regular expressions, would be nice to changed it to use the parsed tree instead.
      • the imported files inside the first one and the ones in any imported less file (by using the imports property of the less.render method)

v1.0.9

  • Build Scripts Changes

v1.0.8

  • Enhancements
    • Better error reporting on auto-prefix failure. Fixes #1 - 6ca8864, royriojas, 09/06/2015 19:31:56

v1.0.7

  • Enhancements
    • Better error reporting on less failure - 5efc53a, royriojas, 08/06/2015 02:09:25

v1.0.6

  • Build Scripts Changes
    • Add changelogx section to package.json - c74747b, royriojas, 08/06/2015 01:46:20

v1.0.5

  • Build Scripts Changes

v1.0.4

  • Build Scripts Changes
    • ignore IDE autogenerated files from npm package - dde496c, royriojas, 08/06/2015 01:37:01

v1.0.3

  • Documentation
    • Update the Readme with the latest changes - 4fb217a, royriojas, 08/06/2015 01:35:43
  • Features
    • Implement the option to add user functions - d850937, royriojas, 08/06/2015 01:35:30

v1.0.2

v1.0.1

  • Documentation
    • Add documentation about simpless module - 792144d, royriojas, 01/06/2015 03:47:19