ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Import Cost

by julianburr ST3 WinOS X

Sublime Text 3 plugin that shows the import costs of imported JS modules

Details

Installs

  • Total 281
  • Win 78
  • OS X 203
  • Linux 0
Apr 20 Apr 19 Apr 18 Apr 17 Apr 16 Apr 15 Apr 14 Apr 13 Apr 12 Apr 11 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12 Mar 11 Mar 10 Mar 9 Mar 8 Mar 7 Mar 6
Windows 2 1 0 1 2 1 1 0 0 0 4 0 0 0 1 3 4 1 0 2 0 0 0 1 2 0 1 0 1 3 1 0 1 1 0 0 1 3 0 2 0 0 0 0 2 0
OS X 1 1 0 0 2 6 2 3 4 2 2 1 0 0 2 8 1 3 1 3 1 0 1 4 4 3 2 0 5 2 1 2 3 0 1 1 2 1 1 0 0 0 1 0 3 4
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Sublime Plugin Import Cost

Sublime Text 3 plugin that shows the import costs of imported JS modules.

Example GIF

Install

The best way is to install the plugin via Package Control, just search for import cost. Besides that, you also have to have node installed, as well as the npm package import-cost:

npm i -g import-cost

Config

To change config options, open the menu Sublime Text > Preferences > Package Settings > Import Cost after installing the plugin. The following options are available:

{
  // Check import costs of npm modules when saving a file
  "check_on_save": true,

  // Check import costs when opening a file
  "check_on_open": true,

  // File sizes for differnt warning levels in kb
  "min_size_warning": 40,
  "min_size_error": 100,

  // Path to node binary
  "node_path": "/usr/local/bin/node",

  // File extensions that should be considered
  "extensions": [ "js", "jsx" ],

  // Show gzip size as well
  "show_gzip": false
}

Shoutouts

To wix for the awesome npm package, and to @princemaple for contributing to make this plugin work on Windows as well 🎉

Todos

  • [x] Add basic menus and settings
  • [x] Add “show gzip” option
  • [x] Make plugin available through plugin manager
  • [x] Make plugin smarter to always find correct node_modules folder, no matter what folder is currently open in sublime
  • [ ] Add caching on python level (import-cost has caching itself, but we still have the expensive node bridge thing going on, which is very avoidable)
  • [x] Windows support