Coder Social home page Coder Social logo

moxystudio / next-pre-compression Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 2.0 276 KB

Next.js plugin to compress static assets at build time and serve them instead of having to compress on-the-fly

License: MIT License

JavaScript 100.00%
brotli compress config gzip nextjs plugin precompress

next-pre-compression's People

Contributors

ivolimasilva avatar ritazoliveira avatar satazor avatar threequartersjohn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

next-pre-compression's Issues

Support absolute URI as assetPrefix

Currently, an assetPrefix that contains an absolute URI like https://cdn.my-website.com is not supported.

To support it we must account for these types of assetPrefix

  1. absolute path like /foo
  2. absolute URI like https://cdn.my-website.com
  3. absolute URI with paths like https://cdn.my-website.com/foo

To support 2 is easy, we just need to detect that pattern and assume an empty assetPrefix. However, 3 can be either mounted with an empty assetPrefix or an assetPrefix of /foo depending on how you setup proxies/load-balancers.

My suggestion is to have a default behavior of assume an empty assetPrefix on 2 and 3 but be customizable through a assetPrefix option.

If you are in the need of supporting absolute URI as the assetPrefix please do a PR that implements the suggestion above. ❤️

Add koa middleware

We are using koa now in our boilerplate, but we are still missing the middleware.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.