Ignoring Files

Sometimes there are files in your Application that you don't want to protect or want to exclude from your Application in order to avoid exceeding your files limit. You can tell Jscrambler to ignore files by using .jscramblerignore file.

Usage

Create a file in your root project folder named .jscramblerignore. This file specifies files that Jscrambler should intentionally ignore when protecting an Application. These files will not be protected neither will they affect your files limit.

Please be aware that the .jscramblerignore should be submitted alongside your Application. This means that if you are using our API you should send this file whenever you protect your Application.

Specifying files to exclude (Patterns)

Each line in a .jscramblerignore file specifies a pattern that represents a path to one or more files:

  • A blank line matches no files (it can serve as a separator for readability)
  • A line starting with # serves as a comment
  • Trailing spaces are ignored unless they are quoted with backslash "\"
  • An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. For patterns that begin with a literal "!", for example "!important.js", put a backslash "\" in front of the first "!", like "\!important.js"
  • If the pattern ends with a slash, it will only find a match with a directory. For example, foo/ will match a directory foo and paths underneath it, but will not match a regular file foo
  • A leading slash matches the beginning of the pathname. For example, "/*.js" matches "foo.js" but not "jscrambler/bar.js"

Two consecutive asterisks "**" in patterns matched against full pathname may have a special meaning:

  • A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere. "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo"
  • A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc" with infinite depth
  • A slash followed by two consecutive asterisks then a slash matches zero or more directories. For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on
  • Other consecutive asterisks are considered invalid

The following is an example of a .jscramblerignore file

# ignore all garbage folders
**/garbage/
# ignore all files in vendor folder
vendor/
# except foo.js
!vendor/foo.js