Skip to content

Latest commit

 

History

History
 
 

expo-optimize

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

👋 Welcome to
expo-optimize

Compress the assets in your project

Circle CI


This library uses the natively powered package Sharp behind the scenes to optimally reduce your project's assets for use in an app or website.

👋 Notice: This package is not limited to Expo projects! This can be used with projects bootstrapped with community CLIs like ignite by Infinite Red, or react-native-cli by the React Native community.

🚀 Usage

# Run this once to install the sharp image processing utility.
# If this cannot be installed on your computer then you won't be able to optimize images.
npm install -g sharp-cli

# To optimize images simply run this
npx expo-optimize <project-directory> [options]

🤔 Why?

We created optimize to improve our docs and websites (Next, Gatsby, React), and our native apps (React Native & Expo). Optimizing images can noticeable improve your native app and website's TTI (or time-to-interaction) which means less time on splash screens and quicker delivery over poor network connections.

⚙️ Options

For more information run npx expo-optimize --help (or -h)

Shortcut Flag Input Description Default
-q --quality [number] The quality each image will attempt to be reduced to 80
-i --include [pattern] Include only assets that match this glob pattern relative to the project root expo.assetBundlePatterns: [] in the app.json
-e --exclude [pattern] Exclude all assets that match this glob pattern relative to the project root '**/node_modules/**', '**/ios/**', '**/android/**'
-s --save Save the original assets with a .orig extension
-h --help output usage information
-V --version output the version number

📚 Further Reading

Read more about how this package works here: Image compression in Expo projects.

Related

  • sharp - native image editing library for node
  • expo-cli - the original location for this command

License

The Expo source code is made available under the MIT license. Some of the dependencies are licensed differently, with the BSD license, for example.


License: MIT