MCPcopy Index your code
hub / github.com/eagerpatch/navita

github.com/eagerpatch/navita @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
348 symbols 899 edges 186 files 1 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Navita Logo

Navita is a powerful CSS-in-JS library that brings type-safe compile-time Atomic CSS-in-JS with zero runtime to your projects.

It allows you to easily style your components and apply themes without the need for any additional runtime dependencies.

With Navita, you can write clean and maintainable CSS in JavaScript, without sacrificing runtime performance.

🔥   All styles generated at build time — just like Sass, Less, etc.

✨   Minimal abstraction over standard CSS.

🦄   Works with any JS-based front-end framework — or even without one.

🎨   High-level theme system with support for simultaneous themes.

💪   Type-safe styles via CSSType.

🌳   Co-locate your styles with your components — if you want to.

🛠   Integrations with popular bundlers such as Webpack, Vite, and Next.js.


🌐 Check out the documentation site for setup guides, examples and API docs.


Installation

To start using Navita in your project, simply follow these steps:

Install Navita using npm:

npm install @navita/css --save

You'll also need to install the Navita integration for your preferred bundler. Navita currently supports Webpack, Vite, and Next.js.

Choose the integration for your preferred bundler:

If you are using Webpack, install the Webpack integration:

npm install @navita/webpack-plugin mini-css-extract-plugin --save-dev

Update your webpack.config.js file to include both MiniCssExtractPlugin and NavitaPlugin:

const { NavitaPlugin } = require('@navita/webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  // Other webpack options,
  plugins: [
    new MiniCssExtractPlugin(),
    new NavitaPlugin(),
  ],
};

Read more about the Webpack integration in the Webpack documentation.

If you are using Vite, install the Vite integration:

npm install @navita/vite-plugin --save-dev

And add it to your vite.config.js file:

import { defineConfig } from 'vite';
import { navita } from '@navita/vite-plugin';

export default defineConfig({
  plugins: [
    // Other plugins
    navita(/* Additional options */)
  ],
});

Read more about the Vite integration in the Vite documentation.

If you are using Next.js, install the Next.js integration:

🚀   React Server Components support!

npm install @navita/next-plugin --save-dev

And add it to your next.config.js file:

const { createNavitaStylePlugin } = require("@navita/next-plugin");

/** @type {import('next').NextConfig} */
const nextConfig = {};

module.exports = createNavitaStylePlugin({
  // Additional options
})(nextConfig);

Read more about the Next.js integration in the Next.js documentation.

Usage

The main entry point for Navita is the style function. Make sure you read the reset of the documentation on https://navita.style to learn more about the APIs.

import { style } from '@navita/css';

const container = style({
  padding: '2rem',
  background: 'hotpink',
  color: 'white',
});

document.write(`



    Hello World!



`);

That's it!

💡 Only references to the classNames will be included in the bundle.

Note: Navita doesn't require special file extensions for your styles. You can co-locate your CSS styles with your components.

Documentation

For detailed documentation, examples, and usage guidelines, please visit the official Navita website: https://navita.style

Contributing

We welcome contributions from the community to make Navita even better!

Thanks

  • Vanilla-Extract and Linaria for the inspiration and the great work on the CSS-in-JS ecosystem.
  • Fela for the fantastic work on Atomic css-in-js.
  • Eagerpatch for giving us the space to do interesting work.

MIT Licensed—A project by Eagerpatch.\ Made with ❤️ by zn4rk and contributors.

Extension points exported contracts — how you extend this code

GetCalleeIdent (Interface)
(no doc) [4 implementers]
packages/swc/crates/common/src/get_callee_ident.rs
IdentifierGenerator (Interface)
(no doc) [3 implementers]
packages/engine/src/types.ts
ContainerProperties (Interface)
(no doc)
packages/types/src/index.ts
Options (Interface)
(no doc)
packages/core/src/createRenderer.ts
Options (Interface)
(no doc)
packages/webpack-plugin/src/index.ts
Config (Interface)
(no doc)
packages/next-plugin/src/index.ts
Options (Interface)
(no doc)
packages/vite-plugin/src/index.ts
Props (Interface)
(no doc)
examples/with-vite/src/components/button.tsx

Core symbols most depended-on inside this repo

style
called by 105
packages/css/src/style.ts
merge
called by 41
packages/css/src/merge.ts
addStyle
called by 33
packages/engine/src/index.ts
renderCssToString
called by 29
packages/engine/src/index.ts
processStyles
called by 24
packages/engine/src/processStyles.ts
transformContentProperty
called by 24
packages/engine/src/helpers/transformContentProperty.ts
setFilePath
called by 20
packages/engine/src/index.ts
next
called by 19
packages/engine/src/types.ts

Shape

Function 199
Method 62
Interface 57
Class 30

Languages

TypeScript90%
Rust10%

Modules by API surface

packages/engine/src/index.ts22 symbols
packages/webpack-plugin/src/getNavitaModule.ts12 symbols
packages/vite-plugin/src/index.ts12 symbols
packages/webpack-plugin/src/index.ts11 symbols
packages/webpack-plugin/src/getNavitaDependency.ts11 symbols
site/contentlayer/generateToc.ts10 symbols
packages/swc/crates/extraction/src/collect_statements.rs9 symbols
packages/types/src/index.ts8 symbols
packages/adapter/src/index.ts8 symbols
packages/swc/crates/extraction/src/lib.rs7 symbols
packages/webpack-plugin/tests/utils/webpack.ts6 symbols
packages/next-plugin/src/optimizeCSSOutput.ts6 symbols

For agents

$ claude mcp add navita \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact