Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add component level stylesheet setting #477

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cjblomqvist
Copy link

Useful for defining styles within a component rather than having all in a separate global file/folder

Basically remove the need for the following plugin: https://github.com/BBWeb/d-component-styles

@enjalot
Copy link
Contributor

enjalot commented Jan 14, 2015

the only reason not to merge this is because for things like stylus where you want to support dependencies this wouldn't be sufficient.
@zag2art @cray0000 did you guys have thoughts on this? I seem to remember a discussion around this.

@cjblomqvist
Copy link
Author

First of all, thanks for swift reply! Looking forward to you having increased attention to PRs, issues, etcetera!

Regarding the PR: Yes, I heard from dadsn that there were some limitations doing it this way, and that using their fork of the derby-stylus repo you can achieve the same functionality (for stylus anyway). We can either leave it or close it for now and maybe I'll look into it a more robust solution inside the Derby core.

If anyone is apt and have time to write failing tests that would be great.

@minicuper
Copy link
Contributor

Your solution is perfect for css but it limits stylus. Let me explain. All is because of stylus global variables. In our clone of derby-stylus you can define a global var inside your main stylus file, for example app.loadStyles('index.styl'):

$success = $00FA22

and use the same var inside you components with default values:

// if global $success is not defined it sets to $00FF00
$success ?= $00FF00

.my-component
  color $success

This is very handy to reuse components in different projects.

But our clone has it's own limits. It assumes that you have only one app.loadStyles in your app and at the moment we have not found the better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants