# omi-snippets **Repository Path**: wscats/omi-snippets ## Basic Information - **Project Name**: omi-snippets - **Description**: 剑走偏锋!实现React单文件组件和Webpack局部编译的IDE插件,可能是最好的React SFCs方案 - Visual Studio Code Syntax highlighting for single-file React and Omi components - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: https://github.com/Wscats/omi-docs - **GVP Project**: No ## Statistics - **Stars**: 12 - **Forks**: 2 - **Created**: 2019-08-10 - **Last Updated**: 2025-06-03 ## Categories & Tags **Categories**: vsc-plugins **Tags**: omi, React, snippets, VSCode ## README # Eno and Omi Snippets [Try it Now!](https://marketplace.visualstudio.com/items?itemName=Wscats.omi-snippets) Visual Studio Code syntax highlighting for single-file Omi.js components (enabled by omil). Or [Download Vsix!](https://github.com/Wscats/omi-snippets/releases/download/2.03/eno-2.0.3.vsix) to install in Visual Studio Code > 下载地址 & Download: https://marketplace.visualstudio.com/items?itemName=Wscats.eno > 项目地址 & Source Code : https://github.com/Wscats/omi-snippets # Detailed Documentation > 详细文档 & Document: https://github.com/Wscats/omi-docs * [介绍 && Introduce](https://wscats.github.io/omi-docs/public/home) * [安装 && Install](https://wscats.github.io/omi-docs/public/install/) * [配合Omi Snippets插件 && Cooperative plugin with Omi Snippets](https://wscats.github.io/omi-docs/public/plugin) * [配合React开发 && Cooperative with React](https://wscats.github.io/omi-docs/public/react) * [语言块规范 && Language Block Specification](https://wscats.github.io/omi-docs/public/spec) * [JSX](https://wscats.github.io/omi-docs/public/jsx) * [Props](https://wscats.github.io/omi-docs/public/props) * [事件处理 && Event](https://wscats.github.io/omi-docs/public/event) * [生命周期 && Lifecycle](https://wscats.github.io/omi-docs/public/lifecycle) * [更新方法 && Update](https://wscats.github.io/omi-docs/public/update) * [Ref](https://wscats.github.io/omi-docs/public/ref) * [Store](https://wscats.github.io/omi-docs/public/store) * [CSS](https://wscats.github.io/omi-docs/public/css) * [高阶组件 && HOC](https://wscats.github.io/omi-docs/public/hoc) # Contributors | [
Eno Yao](https://github.com/Wscats)| [
Aaron Xie](https://github.com/aaron-xie)| [
DK Lan](https://github.com/dk-lan)| [
Yong](https://github.com/flowerField)| [
Li Ting](https://github.com/Liting1)|
Xin| [
Lemon](https://github.com/lemonyyye) | [
Jing](https://github.com/vickySC) | [
Lin](https://github.com/shirley3790) | [
Tian Fly](https://github.com/tiantengfly)| | - | - | - | - | - | - | - | - | - | - | # Quick Start - Install [Omi Snippets](https://marketplace.visualstudio.com/items?itemName=Wscats.omi-snippets). - Try it with [omil](https://github.com/Wscats/omil), a Omi.js components loader based on webpack. - Via Marketplace Control: search for `Omi Snippets` and click install. - Manual: clone this repo and install `omi-snippets.vsix` into your Visual Studio Code. > In addition, if you want to build and install the extension from source, you need to install [vsce](https://code.visualstudio.com/api/working-with-extensions/publishing-extension), like this. ```bash # Then, clone the repository and compile it. git clone https://github.com/Wscats/omi-snippets cd omi-snippets yarn vsce package ``` ![wscats](https://wscats.github.io/omi-snippets/images/omi-snippets.gif) This will setup a basic `webpack` + [omil](https://github.com/Wscats/omil) project for you, with `*.omi` or `*.eno` files and hot-reloading working out of the box! For example, you can create `test.omi` in Visual Studio Code before install [Omi Snippets](https://marketplace.visualstudio.com/items?itemName=Wscats.omi-snippets) ```html ``` After you save the code in editor`(Ctrl+S)`, it will be converted into `test.js` ```jsx // test.js import { WeElement, define, h } from "omi"; import style from "./style.css"; const componentName = class extends WeElement { render() { return h("div", null, this.data.name); } static css = `div{color:red;}` + style; install() { this.data = { name: "Eno Yao" }; } }; define("component-name", componentName); ``` ## Usage In Omi A `*.omi` file is a custom file format that uses HTML-like syntax to describe a Omi component. Each `*.omi` file consists of three types of top-level language blocks: `