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

First, you need to 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.

Then, you must submit the .jscramblerignore file alongside your other files. This means that if you are using our API you should send this file whenever you protect your Application, or if you are using our CLI, you should make sure this file is included in the filesSrc array.

{
  ...
  "filesSrc": [".jscramblerignore", "./src/*"],
  ...
}

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"
  • Paths that begin with "./" are not accepted and are, thus, ignored. Use "jscrambler/foo.js" instead of "./jscrambler/foo.js", for example
  • When using Windows Operating System, make sure to use backslashes "\" instead of forward slashes "/" when specifying paths

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