lessc-helper.js 6.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // lessc_helper.js
  2. //
  3. // helper functions for lessc
  4. var lessc_helper = {
  5. // Stylize a string
  6. stylize: function (str, style) {
  7. var styles = {
  8. 'reset': [0, 0],
  9. 'bold': [1, 22],
  10. 'inverse': [7, 27],
  11. 'underline': [4, 24],
  12. 'yellow': [33, 39],
  13. 'green': [32, 39],
  14. 'red': [31, 39],
  15. 'grey': [90, 39]
  16. };
  17. return "\u001B[" + styles[style][0] + "m" + str + "\u001B[" + styles[style][1] + "m";
  18. },
  19. // Print command line options
  20. printUsage: function () {
  21. console.log('usage: lessc [option option=parameter ...] <source> [destination]');
  22. console.log('');
  23. console.log('If source is set to `-\' (dash or hyphen-minus), input is read from stdin.');
  24. console.log('');
  25. console.log('options:');
  26. console.log(' -h, --help Prints help (this message) and exit.');
  27. console.log(' --include-path=PATHS Sets include paths. Separated by `:\'. `;\' also supported on windows.');
  28. console.log(' -M, --depends Outputs a makefile import dependency list to stdout.');
  29. console.log(' --no-color Disables colorized output.');
  30. console.log(' --ie-compat Enables IE8 compatibility checks.');
  31. console.log(' --js Enables inline JavaScript in less files');
  32. console.log(' -l, --lint Syntax check only (lint).');
  33. console.log(' -s, --silent Suppresses output of error messages.');
  34. console.log(' --strict-imports Forces evaluation of imports.');
  35. console.log(' --insecure Allows imports from insecure https hosts.');
  36. console.log(' -v, --version Prints version number and exit.');
  37. console.log(' --verbose Be verbose.');
  38. console.log(' --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map).');
  39. console.log(' --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths.');
  40. console.log(' --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.');
  41. console.log(' --source-map-include-source Puts the less files into the map instead of referencing them.');
  42. console.log(' --source-map-inline Puts the map (and any less files) as a base64 data uri into the output css file.');
  43. console.log(' --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment');
  44. console.log(' in generated CSS file.');
  45. console.log(' --source-map-no-annotation Excludes the sourceMappingURL comment from the output css file.');
  46. console.log(' -rp, --rootpath=URL Sets rootpath for url rewriting in relative imports and urls');
  47. console.log(' Works with or without the relative-urls option.');
  48. console.log(' -ru=, --rewrite-urls= Rewrites URLs to make them relative to the base less file.');
  49. console.log(' all|local|off \'all\' rewrites all URLs, \'local\' just those starting with a \'.\'');
  50. console.log('');
  51. console.log(' -m=, --math=');
  52. console.log(' always Less will eagerly perform math operations always.');
  53. console.log(' parens-division Math performed except for division (/) operator');
  54. console.log(' parens | strict Math only performed inside parentheses');
  55. console.log(' strict-legacy Parens required in very strict terms (legacy --strict-math)');
  56. console.log('');
  57. console.log(' -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units');
  58. console.log(' --strict-units=on|off that cannot be represented.');
  59. console.log(' --global-var=\'VAR=VALUE\' Defines a variable that can be referenced by the file.');
  60. console.log(' --modify-var=\'VAR=VALUE\' Modifies a variable already declared in the file.');
  61. console.log(' --url-args=\'QUERYSTRING\' Adds params into url tokens (e.g. 42, cb=42 or \'a=1&b=2\')');
  62. console.log(' --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins');
  63. console.log(' less-plugin. E.g. the clean css plugin is called less-plugin-clean-css');
  64. console.log(' once installed (npm install less-plugin-clean-css), use either with');
  65. console.log(' --plugin=less-plugin-clean-css or just --clean-css');
  66. console.log(' specify options afterwards e.g. --plugin=less-plugin-clean-css="advanced"');
  67. console.log(' or --clean-css="advanced"');
  68. console.log(' --disable-plugin-rule Disallow @plugin statements');
  69. console.log('');
  70. console.log('-------------------------- Deprecated ----------------');
  71. console.log(' -sm=on|off Legacy parens-only math. Use --math');
  72. console.log(' --strict-math=on|off ');
  73. console.log('');
  74. console.log(' --line-numbers=TYPE Outputs filename and line numbers.');
  75. console.log(' TYPE can be either \'comments\', which will output');
  76. console.log(' the debug info within comments, \'mediaquery\'');
  77. console.log(' that will output the information within a fake');
  78. console.log(' media query which is compatible with the SASS');
  79. console.log(' format, and \'all\' which will do both.');
  80. console.log(' -x, --compress Compresses output by removing some whitespaces.');
  81. console.log(' We recommend you use a dedicated minifer like less-plugin-clean-css');
  82. console.log('');
  83. console.log('Report bugs to: http://github.com/less/less.js/issues');
  84. console.log('Home page: <http://lesscss.org/>');
  85. }
  86. };
  87. // Exports helper functions
  88. // eslint-disable-next-line no-prototype-builtins
  89. for (var h in lessc_helper) {
  90. if (lessc_helper.hasOwnProperty(h)) {
  91. exports[h] = lessc_helper[h];
  92. }
  93. }
  94. //# sourceMappingURL=lessc-helper.js.map