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 112
  • Win 24
  • OS X 88
  • Linux 0
Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10 Jan 9 Jan 8 Jan 7 Jan 6 Jan 5 Jan 4 Jan 3 Jan 2 Jan 1 Dec 31 Dec 30 Dec 29 Dec 28 Dec 27 Dec 26 Dec 25 Dec 24 Dec 23 Dec 22 Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10
Windows 1 0 0 1 0 0 1 0 0 0 0 1 2 1 0 0 0 1 0 0 0 1 1 0 0 2 0 0 0 2 1 1 0 0 0 0 0 0 0 1 1 2 2 0 0
OS X 0 1 1 1 2 2 3 0 3 0 2 3 3 1 1 6 0 3 6 1 4 0 3 0 1 3 1 1 3 5 3 4 0 2 2 2 3 2 0 3 6 1 0 4 0
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

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