MadLittleMods / MadLittleMods/postcss-css-variables

Define global variables as css file

Open
#60 10 comments 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
551
Forks
63
PR merge metrics
No merged PRs in 30d

Description

It's just a suggestion for implement.

Now global variables defined as 'variables' in options. And it is an js object.

For me it would be better to import variables as file instead, for example:

options: { variablesPath: 'src/variables.css' }

P.S. Why I need it:

It's because I use css-modules and have no way to set variables declarations somewhere top.

It is possible to import variables from every file which needs them, but I'm using variables as a method to decouple components from global files :) As a context for component...

The solution I use for now is implicitly importing of variables file in sass-loader.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the option handling for the existing variables JavaScript object and trace how variable declarations are processed. Define how options.variablesPath should load src/variables.css, including its interaction with CSS Modules, then verify that variables imported through the path produce the same transformed output as the current option.

Written by the indexing model from the issue text.

Assessment

Tech stack
css, javascript
Domain
frontend, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.