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

atblock_pre and atblock_post don't seem to have an effect #48

Open
cwallacetlc opened this issue Feb 22, 2017 · 3 comments
Open

atblock_pre and atblock_post don't seem to have an effect #48

cwallacetlc opened this issue Feb 22, 2017 · 3 comments

Comments

@cwallacetlc
Copy link

I'd like my @media blocks to have a newline after the brace, so I've set atblock_pre to {\n in the config file (pasted below), but when I run it, the @media blocks come out like this:

@media screen and (max-width:1130px) {.header-logo {
        margin-top: 20px;
    }

There should be a newline and four spaces before .header-logo. It looks like atblock_pre is ignored, and it always just puts a single brace.

Also, I've compared the output between a config file that defines atblock_pre and atblock_post and one that doesn't, and the output files were identical. It seems those two options are completely ignored.

Config file:

{
    "selector_comma": ",\n",
    "indent": "    ",
    "atblock_pre": "{\n    "
}
@fidian
Copy link
Owner

fidian commented Feb 22, 2017

It looks like atblock_pre and atblock_post are not honored, but instead it is using block_pre and block_post. Please give that a shot. This is a bug and should get fixed, though I would much rather rewrite the parser and eliminate the mess of code that I have inside this project.

@cwallacetlc
Copy link
Author

Using block_pre, it is better. I'm able to put a newline + spaces after the opening brace for the at-block. But then I get an extra blank line at the beginning of normal blocks. It seems that's caused by property_pre, which I can set to the empty string.

That just about gets me where I want to be! The only issue now is two trailing lines at the end of at-blocks, caused by stylesheet_whitespace being two newlines. But if I do anything with that, I won't get a blank line between rules, which I do want. I think I'll just write a script to delete blank lines before a closing brace.

Thanks!

@fidian
Copy link
Owner

fidian commented Feb 23, 2017

I've tried poking into the issue myself and modifying code so it uses atblock_pre and atblock_post. It looks like I will need to rewrite the entire block output code because I should have something to strip the whitespace between the inside block and the outer atblock. Unfortunately, this affects a lot more than what I had intended and will likely change how the CSS is generated across the tool.

While it is a good idea for me to rewrite this, I don't know when I'll have enough time to dedicate to the project. :-( Even if I did make atblock_pre and atblock_post honored, you would end up with the same issues as what you're having right now.

Edit: Leaving this open because it is certainly a flaw in the software. I'll retain hope that I will return to this project and fix it in the future.

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

No branches or pull requests

2 participants