Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dot option for minimatch #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ bundler.transform({
bundler.bundle().pipe(process.stdout)
```

For any files/directories containing a dot, you can pass in the `dot: true`
[option for minimatch](https://github.com/isaacs/minimatch#dot)

```javascript
bundler.transform({
global: true,
ignore: [
'**/node_modules/sql.js/**'
],
dot: true
}, 'uglifyify')
```

## Source Maps

Uglifyify supports source maps, so you can minify your code and still see the
Expand Down
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function uglifyify(file, opts) {

delete opts._flags

if (ignore(file, opts.ignore)) {
if (ignore(file, opts.ignore, opts.dot)) {
return through()
}

Expand Down Expand Up @@ -102,13 +102,15 @@ function uglifyify(file, opts) {
}
}

function ignore(file, list) {
function ignore(file, list, dot) {
if (!list) return

list = Array.isArray(list) ? list : [list]

return list.some(function(pattern) {
var match = minimatch(pattern)
var match = minimatch(pattern, {
dot: dot
})
return match.match(file)
})
}