ImportJS
Sublime Text plugin for ImportJS
Details
Installs
- Total 5K
- Win 2K
- Mac 2K
- Linux 1K
Jul 26 | Jul 25 | Jul 24 | Jul 23 | Jul 22 | Jul 21 | Jul 20 | Jul 19 | Jul 18 | Jul 17 | Jul 16 | Jul 15 | Jul 14 | Jul 13 | Jul 12 | Jul 11 | Jul 10 | Jul 9 | Jul 8 | Jul 7 | Jul 6 | Jul 5 | Jul 4 | Jul 3 | Jul 2 | Jul 1 | Jun 30 | Jun 29 | Jun 28 | Jun 27 | Jun 26 | Jun 25 | Jun 24 | Jun 23 | Jun 22 | Jun 21 | Jun 20 | Jun 19 | Jun 18 | Jun 17 | Jun 16 | Jun 15 | Jun 14 | Jun 13 | Jun 12 | Jun 11 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 2 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Mac | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 | 1 | 0 | 0 | 0 | 1 | 0 |
Readme
- Source
- raw.githubusercontent.com
ImportJS is a tool that helps you import dependencies in your JavaScript project. More information is available in the main import-js project.
Running import-js in Sublime Text
Install the ImportJS plugin via Package Control
Install the import-js npm package
npm install -g import-js
Open the root of your project as a folder (Project -> Add Folder to Project…)
Import a file!
Whenever you have undefined variables, open the Command Palette
(CTRL+SHIFT+P
/CMD+SHIFT+P
) and select “ImportJS: fix all imports”, or
“ImportJS: import word under cursor”.
It will be helpful to bind import_js
to easy-to-use bindings, such as:
{ "keys": ["super+alt+i"], "command": "import_js", "args": { "command": "fix" } },
{ "keys": ["super+alt+j"], "command": "import_js", "args": { "command": "word" } },
{ "keys": ["super+alt+g"], "command": "import_js", "args": { "command": "goto" } },
Available commands:
- “ImportJS: fix all imports”
- “ImportJS: import word under cursor”
- “ImportJS: goto module”
- “ImportJS: terminate daemon”
Troubleshooting
If you get an error message saying something like “Can't find import-js
executable”, you may need to specify a path to the importjs
executable in
configuration. This likely means that you are using a tool like
nvm or nodenv to manage
multiple Node versions on your system.
To fix this, you need to make sure that the code that sets up your PATH
is in
the correct location. This plugin will open a login shell to determine the
proper PATH
, so the code that sets up your PATH
needs to be in a file that
is sourced for login shells. Here's a handy table:
Shell | File |
---|---|
bash | ~/.bash_profile |
zsh (Mac OS X) | ~/.zprofile |
zsh (Linux) | ~/.zshenv or ~/.zprofile |
fish | ~/.config/fish/config.fish |
Alternatively, you can also try editing the ImportJS User Settings from the
Preferences > Package Settings > ImportJS > Settings — User menu and add the folder where the importjs
executable is located to the paths
option. Example:
{
"paths": ["/Users/USERNAME/.nvm/versions/node/v4.4.3/bin"]
}
Please note that you can't use ~ to refer to the home directory, you need to
specify the full path. To figure out where your importjs
executable is
located, you can run which importjs
from your project's directory.