Module minifier::js

source ·

Structs

Enums

Functions

  • Aggregate litteral strings. For instance, if the string litteral “Oh look over there!” appears more than once, a variable will be created with this value and used everywhere the string appears. Of course, this replacement is only performed when it allows to take less space.
  • Aggregate litteral strings. For instance, if the string litteral “Oh look over there!” appears more than once, it will be added to the generated array and used everywhere the string appears. Of course, this replacement is only performed when it allows to take less space.
  • Same as aggregate_strings_into_array except it allows certain strings to not be aggregated thanks to the filter parameter. If it returns false, then the string will be ignored.
  • Exactly like aggregate_strings_into_array except this one expects a separation token to be passed. This token will be placed between the created array for the strings aggregation and the rest.
  • Same as aggregate_strings_into_array_with_separation except it allows certain strings to not be aggregated thanks to the filter parameter. If it returns false, then the string will be ignored.
  • Exactly like aggregate_strings except this one expects a separation token to be passed. This token will be placed between the created variables for the strings aggregation and the rest.
  • Returns true if the token is a “useful” one (so not a comment or a “useless” character).
  • Returns true if the token is a “useful” one (so not a comment or a “useless” character).
  • Convenient function used to clean useless tokens in a token list.
  • Same as clean_tokens except that if a token is considered as not desired, the callback is called. If the callback returns false as well, it will be removed.
  • When looping over Tokens, if you encounter Keyword::Var, Keyword::Let or Token::Other using this function will allow you to get the variable name’s position and the variable value’s position (if any).
  • Minifies a given JS source code.
  • Replace a given token with another.
  • Replace given tokens with others.
  • Simple function to get the untouched token list. Useful in case you want to perform some actions directly on it.