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

Add type file, Support nested files, / index routes, and trailing ? query strings #2

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ npm-debug.log*

# Dependency directory
node_modules
package-lock.json

wallzero marked this conversation as resolved.
Show resolved Hide resolved
# Optional npm cache directory
.npm
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ You can still add dynamic compression for files that you don't have a static ver

## Usage ES5
```javascript
preCompressedAssets = require('pre-compressed-assets');
preCompressedAssets = require('pre-compressed-assets');
compression = require('compression');

//Add the middleware express way:
app.use(preCompressedAssets(/\.(html|js|css)$/, path.join(__dirname, 'public')));
app.use(preCompressedAssets(/\.(html|js|css)/, path.join(__dirname, 'public')));

//Add dynamic compression if you don't handle all files static
app.use(compression());
Expand All @@ -36,7 +36,7 @@ import preCompressedAssets from 'pre-compressed-assets';
import compression from 'compression';

//Add the middleware express way:
app.use(preCompressedAssets(/\.(html|js|css)$/, path.join(__dirname, 'public')));
app.use(preCompressedAssets(/\.(html|js|css)/, path.join(__dirname, 'public')));

//Add dynamic compression if you don't handle all files static
app.use(compression());
Expand Down
7 changes: 7 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module 'pre-compressed-assets' {
import express = require('express');

function preCompressedAssets(urlRegexp: RegExp, publicPath: string): express.RequestHandler;

export = preCompressedAssets;
}
Loading