lessc-helper.js 5.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 '\x1b[' + styles[style][0] + 'm' + str +
  18. '\x1b[' + styles[style][1] + 'm';
  19. },
  20. //Print command line options
  21. printUsage: function() {
  22. console.log("usage: lessc [option option=parameter ...] <source> [destination]");
  23. console.log("");
  24. console.log("If source is set to `-' (dash or hyphen-minus), input is read from stdin.");
  25. console.log("");
  26. console.log("options:");
  27. console.log(" -h, --help Prints help (this message) and exit.");
  28. console.log(" --include-path=PATHS Sets include paths. Separated by `:'. `;' also supported on windows.");
  29. console.log(" -M, --depends Outputs a makefile import dependency list to stdout.");
  30. console.log(" --no-color Disables colorized output.");
  31. console.log(" --no-ie-compat Disables IE compatibility checks.");
  32. console.log(" --no-js Disables JavaScript in less files");
  33. console.log(" -l, --lint Syntax check only (lint).");
  34. console.log(" -s, --silent Suppresses output of error messages.");
  35. console.log(" --strict-imports Forces evaluation of imports.");
  36. console.log(" --insecure Allows imports from insecure https hosts.");
  37. console.log(" -v, --version Prints version number and exit.");
  38. console.log(" --verbose Be verbose.");
  39. console.log(" --source-map[=FILENAME] Outputs a v3 sourcemap to the filename (or output filename.map).");
  40. console.log(" --source-map-rootpath=X Adds this path onto the sourcemap filename and less file paths.");
  41. console.log(" --source-map-basepath=X Sets sourcemap base path, defaults to current working directory.");
  42. console.log(" --source-map-less-inline Puts the less files into the map instead of referencing them.");
  43. console.log(" --source-map-map-inline Puts the map (and any less files) as a base64 data uri into the output css file.");
  44. console.log(" --source-map-url=URL Sets a custom URL to map file, for sourceMappingURL comment");
  45. console.log(" in generated 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, --relative-urls Re-writes relative urls to the base less file.");
  49. console.log(" -sm=on|off Turns on or off strict math, where in strict mode, math.");
  50. console.log(" --strict-math=on|off Requires brackets. This option may default to on and then");
  51. console.log(" be removed in the future.");
  52. console.log(" -su=on|off Allows mixed units, e.g. 1px+1em or 1px*1px which have units");
  53. console.log(" --strict-units=on|off that cannot be represented.");
  54. console.log(" --global-var='VAR=VALUE' Defines a variable that can be referenced by the file.");
  55. console.log(" --modify-var='VAR=VALUE' Modifies a variable already declared in the file.");
  56. console.log(" --url-args='QUERYSTRING' Adds params into url tokens (e.g. 42, cb=42 or 'a=1&b=2')");
  57. console.log(" --plugin=PLUGIN=OPTIONS Loads a plugin. You can also omit the --plugin= if the plugin begins");
  58. console.log(" less-plugin. E.g. the clean css plugin is called less-plugin-clean-css");
  59. console.log(" once installed (npm install less-plugin-clean-css), use either with");
  60. console.log(" --plugin=less-plugin-clean-css or just --clean-css");
  61. console.log(" specify options afterwards e.g. --plugin=less-plugin-clean-css=\"advanced\"");
  62. console.log(" or --clean-css=\"advanced\"");
  63. console.log("");
  64. console.log("-------------------------- Deprecated ----------------");
  65. console.log(" --line-numbers=TYPE Outputs filename and line numbers.");
  66. console.log(" TYPE can be either 'comments', which will output");
  67. console.log(" the debug info within comments, 'mediaquery'");
  68. console.log(" that will output the information within a fake");
  69. console.log(" media query which is compatible with the SASS");
  70. console.log(" format, and 'all' which will do both.");
  71. console.log(" -x, --compress Compresses output by removing some whitespaces.");
  72. console.log(" We recommend you use a dedicated minifer like less-plugin-clean-css");
  73. console.log("");
  74. console.log("Report bugs to: http://github.com/less/less.js/issues");
  75. console.log("Home page: <http://lesscss.org/>");
  76. }
  77. };
  78. // Exports helper functions
  79. for (var h in lessc_helper) { if (lessc_helper.hasOwnProperty(h)) { exports[h] = lessc_helper[h]; }}