Coder Social home page Coder Social logo

smarterlabs / omni Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 325 KB

Omni-Directional Documents (.omni, .odd)

Home Page: https://marketplace.visualstudio.com/items?itemName=smarterlabs.vscode-omni

License: MIT License

JavaScript 99.82% Shell 0.18%
omni odd

omni's Introduction

Omni logo

Omni-Directional Documents (.omni, .odd)

Note: All packages in this monorepo should be considered a work-in-progress. APIs may change dramatically.

Think of Omni-Directional Documents as "smart markdown files" that are capable of doing things such as variable interpolation between files, file bundling, using multiple languages in one file, and more. Since the syntax is 90% markdown, you can benefit from linting and code highlighting that you get in markdown file code blocks.

Example .omni file

Current Packages

Directives

Note: More on the way!

config

A code block with a config directive is usually used to give instructions to Omni about how a file should be run or processed.

run

A code block with a run directive will execute the code block every time the file is processed. This can be useful for fetching data from an API to pass to another code block, or logging out debug information about the file that is being processed.

export

A code block with the export directive will export the code block to its own file after it has been processed

Directive aliases

You can create your own directives with directive aliases:

const omni = new Omni({
	input: `example`,
	output: `dist`,
	aliases: {
		script: `export:../dist/js/scripts/*.js`,
		style: `export:../dist/css/styles/*.css`,
	},
})

export default omni

And then use these directives:


```js script
console.log(`I was exported to another directory via alias!`)
```

```css style
body{
	margin: 0;
}
```

The script and style aliases will use the export directives in the config and export to thier respective locations.

Use Cases

  • Using component-style patterns with frameworks that don't support them
  • Keeping documentation with code
  • Keeping tests with code
  • Coordinating events between server and client side code in a decoupled environment
  • Rapid prototyping in your documentation
  • Working with multiple frameworks simultaneously
  • Getting backend devs more familiar with front end or front end devs more familiar with backend
  • Expressing user flow in production code

omni's People

Contributors

dependabot[bot] avatar kennedyrose avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tbaustin

omni's Issues

File deletion

From my notes:

  • File deletion
    • Export plugin should keep a map in memory of all files and their outputs
      • key=output
      • value=array of .omni files
    • Export plugin should also keep an in memory array of all .omni files

Directive aliases

alias:liquid-snippet

Instead of:

export:../theme/src/snippets/*.liquid

config:

import omniTemplates from '@smarterlabs/omni-templates'

omniTemplates({
 'liquid-snippet': data => {
    
  }
})

Diagram in readme

Show file contents on a chart:

  • component.omni
  • terminal input
  • output
    • terminal output
    • file outputs

String replace plugin

If applied to the entire markdown file, it could be useful for name replacing in license, and readme files.

Require support

Currently have to: const omniYAML = require(@smarterlabs/omni-yaml).default

omni-core package

@smarterlabs/omni package should be the core with some other plugins baked in.

Main config block

No interpolate directive on configs

interpolate:
  _scope_: nav
otherSetting: true

instead of:

_scope_: nav
otherSetting: true

Import plugin(s)

Allows an import to be declared in config that cascades into code blocks. Could be used to easily import JS, SCSS, and Liquid files with one declaration.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.