openstyles / openstyles/stylus

Integrating Stylus to external text editors

Open
#91 11 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
6.9k
Forks
382
PR merge metrics
No merged PRs in 30d

Description

So I am working on a new extension that brings the power of external editing to Stylus. We can integrate it directly to Stylus when the project is usable.

For now here is the summary:

  1. We have a multiple platform compatible native integration; https://github.com/openstyles/native-client. This project is forked from https://github.com/andy-portmen/native-client. I have modified the source code so we can now write native NodeJS code inside our extension code. The native client can be installed in Windows, Mac, and Linux for now. I've tried the Mac version, not the rest! We have automated OS specific installers here; https://github.com/openstyles/native-client/releases. The project is automatically compiled here https://travis-ci.org/openstyles/native-client
  2. There is a simple extension to demonstrate how native integration works. https://github.com/openstyles/sample-native-extension. Basically, we can compile a NodeJS code in the extension side like https://github.com/openstyles/sample-native-extension/blob/master/background.js#L18-L20. Note that all required modules need permission before they are functional; https://github.com/openstyles/sample-native-extension/blob/master/background.js#L16. The native client only understands two commands:
    • {method: 'spec'}
    • {permissions:[], script: "/*NodeJS script here*/"}
  3. The actual external editor integration is in https://github.com/openstyles/stylus-external-editor. For now, it performs the following actions when called.
    • creates a temporary file in the OS level temporary directory
    • Opens the temporary file in Sublime Text (this part is written to work for Mac OS for now)
    • Watches file changes and prints the entire file in the console when a change is registered.

Notes:

  1. Since the "stylus-external-editor" extension has no id, you need to modify https://github.com/openstyles/native-client/blob/master/config.js with the correct extension id before running the installer.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked openstyles/native-client and sample-native-extension projects, then inspect stylus-external-editor and native-client/config.js. The issue describes a prototype for temporary files, Sublime Text, and file watching, but does not define the Stylus entry point or acceptance criteria for completing the integration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
desktop, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.