Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CSS Modules #211

Open
Feature
@Archmonger

Description

@Archmonger

Current Situation

There is built-in method of directly tying a CSS file to a component

Proposed Actions


Design Idea: Apply in-line styles via Pythoncssselect

We could parse the CSS document usinglxml.cssselect and potentially add the styles in-line. Would need to generate some sort of VDOM-LXML compatibility layer though. Maybe we store our VDOM as an attribute on each LXML node?


Design Idea: Apply in-line styles via Python homebrewed VDOM selector engine

It might be make sense (from a performance standpoint) to homebrew a VDOM-compatible CSS selection engine... There are a couple we can take inspiration from:vtree-select,cssauron. This would be a pretty large undertaking, and gets really tricky with all of the CSS level 3 selectors.


Design Idea: Leveragedjango_css

Add acss_module decorator that loads a stylesheet usingdjango_css(..., only_once=True) (see here:#194).

By default, it will attempt to load the Django static file named<REACTPY_STYLESHEET_SUBDIR>/<COMPONENT_DOTTED_PATH>.css. But the user will be able to override the path using positional args.

Will need asettings.py configuration setting calledREACTPY_STYLESHEET_SUBDIR. Additionally, it makes sense for a manual override to exist within the decoratorcss_module(subdir="...") for library maintainers to use.

This doesn't really "tie" a piece of CSS to a component. It only ties the load time together.


Design Idea: Apply in-line styles via JavaScript (client sided)

It's also possible for us to instead apply the inline styles client-sided, via somekind of JavaScript. There appears to be apackage that does this.

This would be pretty janky in terms of loading behavior.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp