Skip to content

Create new pen from local html/js/css files with ease

License

Notifications You must be signed in to change notification settings

elrumordelaluz/codepen-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

codepen-cli

The live editor of CodePen is not stable for me most of the time due to the network (in China...), so I always write demos on my local machine first, then open CodePen afterwards and copy/paste into the editor.

This tool is for saving this process by doing the following steps:

  1. Extract external or inline scripts and styles of a local HTML file.
  2. Open a new CodePen editor with default browser.
  3. Prefill each html/js/css section and external depencencies in the editor automatically.

The rest is to click the SAVE button.

Installation

$ npm install -g @yuanchuan/codepen-cli

Example

$ codepen index.html

It can be used to preview a markdown file quickly on CodePen:

$ codepen README.md

Edit a JS file on CodePen:

$ codepen example.js

Options

keep-inline

By default all the inline script/style in HTML will be put into js/css sections seperatly, but they can stay with the HTML using keep-inline option.

$ codepen index.html --keep-inline

References

https://blog.codepen.io/documentation/prefill

Usage

Usage:
  codepen <filename>

Options:
  --keep-inline: Keep inline styles/scripts inside html
  --help:        Display help info

Supported filename types by extension:
  htm, html, md, markdown, js, ts, css, less, sass, scss, styl

About

Create new pen from local html/js/css files with ease

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%