0.0.7 • Published 7 months ago

@parcz/neon v0.0.7

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

neon

This template should help get you started developing with Vue 3 in Vite. You need to have node installed, we recommend to use v16.20.2 +.

Recommended IDE Setup

VSCode + Volar (and disable Vetur) + TypeScript Vue Plugin (Volar).

At this point we haven't looked into extensions for other editors.

Project Setup

npm install

Compile and Hot-Reload for Development

npm run dev

Compile and Minify for Production

npm run build

Lint with ESLint

npm run lint

Implement

Customize configuration

See Vite Configuration Reference.

Using with build step

  1. Open a Terminal/Command line, select one "create vite" commands from the list below and copy paste, for instance npm create vite@latest my-vue-app -- --template vue
# npm 6.x
npm create vite@latest my-vue-app --template vue

# npm 7+, extra double-dash is needed:
npm create vite@latest my-vue-app -- --template vue

# yarn
yarn create vite my-vue-app --template vue

# pnpm
pnpm create vite my-vue-app --template vue
  1. In the same terminal/command line follow the instructions presented. It's two commands,
cd my-vue-app
npm i @parcz/neon
  1. Open up the project in your editor of choice

  2. Find main.js and replate the contents of it with the following

import { createApp } from 'vue'
import App from './App.vue'
import { NAction, NContainer, modifiers } from '@parcz/neon'
import '@parcz/neon/dist/neon.css'

const app = createApp(App)

/* neon */

app.component('n-action', NAction)
app.component('n-container', NContainer)

/* Directives */

app.directive('modifiers', modifiers)

/* current app.use installs */

app.mount('#app')
  1. Find App.vue and add the following in the area
<n-action text="Neon button" v-modifiers="['primary']"></n-action>
  1. Run the project with npm run dev and navigate to the url presented. You should now see a button that is imported from neon.

We recommend importing only the components you need, doing so will treeshaking possible. We import the css like this for now so you can test the library.

/* src/main.js */

import { createApp } from 'vue'
import App from './App.vue'
import { NAction, NContainer, modifiers } from '@parcz/neon'
import '@parcz/neon/dist/neon.css'

const app = createApp(App)

/* neon */

app.component('n-action', NAction)
app.component('n-container', NContainer)

/* Directives */

app.directive('modifiers', modifiers)

/* current app.use installs */

app.mount('#app')

It is possible to import all of the components.

/* src/main.js */

import { createApp } from 'vue'
import App from './App.vue'
import { neon, modifiers } from '@parcz/neon'
import '@parcz/neon/dist/neon.css'

const app = createApp(App)

/* neon */

app.use(neon)

/* Directives */

app.directive('modifiers', modifiers)

/* current app.use installs */

app.mount('#app')

It is also possible to import the files from a CDN.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Your Vue App with neon</title>

    <!-- Import Vue.js from CDN -->
    <script src="https://cdn.jsdelivr.net/npm/vue@3"></script>

    <!-- Import your neon library from jsDelivr -->
    <script src="https://cdn.jsdelivr.net/npm/@hurdal/neon/dist/neon.umd.js"></script>

	<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@hurdal/neon/dist/neon.css">
</head>

<body>
    <div id="app">
        <n-action text="Save"></n-action>
    </div>

    <script>
        const app = Vue.createApp({});

		app.use(DcLib);
    	app.mount('#app');
    </script>

</body>

</html>

Styling guidelines

We use logical properties. Just to name a few.

  • width > inline-size
  • min-width > min-inline-size
  • max-width > max-inline-size
  • height > block-size
  • min-height > min-block-size
  • max-height > max-block-size

BEM (Block, Element, Modifier) Methodology**

BEM is a front-end naming methodology thought up outside the context of any particular programming environment. It's a way for developers to ensure that their CSS is scalable and maintainable. Here's a summary:

  1. Purpose:

    • Makes CSS more readable and understandable.
    • Simplifies naming conventions.
    • Creates a rigid structure that helps in scaling and maintaining large codebases.
  1. Components:

    • Block: A standalone entity that is meaningful on its own. E.g., header, container, menu.
    • Element: A part of a block that has no standalone meaning and is semantically tied to its block. E.g., menu item, list item.
    • Modifier: A flag on a block or element that changes appearance or behavior. E.g., disabled, highlighted.
  1. Naming Convention:

    • Block: .block
    • Element: .block__element
    • Modifier: .block--modifier or .block__element--modifier
  1. Benefits:

    • Modularity: You can move blocks around your project freely and independently.
    • Reusability: Creating UI components becomes more straightforward, as you know the class structure.
    • Structure: Provides a clear and consistent codebase structure, making it easier for new team members to understand.
  1. Examples:

    • Block: .button
    • Element within the block: .button__text
    • Modifier for the block: .button--large
  1. Implementation:

    • Use a preprocessor like SCSS or LESS for more manageable nested code, but remember that BEM doesn't depend on them. It's simply a naming convention.
  1. Caveats:
    • Might appear verbose to those unfamiliar with the method.
    • Requires discipline and adherence from the team to ensure it's implemented consistently.

By utilizing the BEM methodology, developers and teams can avoid a lot of common pitfalls associated with CSS development, such as specificity wars, over-reliance on nesting, and obscure class naming. The BEM methodology provides a clear system for writing clean, scalable, and maintainable CSS.

0.0.7

7 months ago

0.0.6

7 months ago

0.0.5

7 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago