Skip to content

Converts the selected JS lines to string (single-line/concatenated).

License

Notifications You must be signed in to change notification settings

alexmunteanu/js-to-string

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JS to string (Atom package)

Converts the selected JS lines to string (single-line/concatenated).

Concatenated

js-to-string demo convert concatenated

Single-line

js-to-string demo convert single-line

Installation

  • Via apm
apm install js-to-string
  • From Atom
    • Settings > Install > Search packages for js-to-string.
    • Click Install and then reload Atom.
  • From GitHub
    • Download the latest release and extract the archive directly to /users/YOUR_USERNAME/.atom/packages.
    • Run npm install.

Usage

  • Make a selection.
  • Then do one of the following:
    • Press Ctrl + Alt + Shift + S on Windows or Cmd + Alt + Shift + S on Mac.
    • Right click and choose JS to string.
    • From Atom's menu: Packages > JS to string > Convert.

Features

  • Auto-complete selections:
    • the selection will be updated automatically so that the start and end lines are completely selected.
  • JS beautifier:
    • the selected lines can be beautified before they're stringified.

Options

  • String:
    • Style: Choose between single-line or concatenated. Default: concatenated.
    • Quotes: Use single or double quotes to wrap the string. Default: single.
    • Strip comments: Generate the string without the commented-out lines. Default: false.
    • Include whitespaces: If this is unchecked, any tabs or new line characters will be stripped. Default: true.
    • Add trailing character: Insert a custom character after the quotes. Default: true.
    • Trailing character: The character that will be inserted at the end of the string, after the quotes. Default: ;.
  • JS Beautifier:
    • Beautify: The selected code will be first beautified before it's stringified. Default: true.
    • Indent size: Number of spaces used to represent a tab. Default: 2.

Buy me a beer

Donate