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

Parse and stringify lose semicolon in custom property set #1045

Closed
alexander-akait opened this issue Jun 29, 2017 · 3 comments
Closed

Parse and stringify lose semicolon in custom property set #1045

alexander-akait opened this issue Jun 29, 2017 · 3 comments

Comments

@alexander-akait
Copy link

alexander-akait commented Jun 29, 2017

Example:

"use strict";

const postcss = require("postcss");
const css = ":root { --foo: { color: red };; --bar: { color: blue }; --bar-foo: { color: red }; }";

console.log(postcss.parse(css).toString());

Output (no extra semicolon after --foo):

:root { --foo: { color: red }; --bar: { color: blue }; --bar-foo: { color: red }; }

Seems (:root { --foo: { color: red };; --bar: { color: blue }; --bar-foo: { color: red }; }) --bar node doesn't contain this extra semicolon in raws.before:

Rule {
      raws: 
       { before: ' ',
         between: ' ',
         semicolon: false,
         after: ' ',
         ownSemicolon: ';' },
      type: 'rule',
      nodes: 
       [ Declaration {
           raws: [Object],
           type: 'decl',
           parent: [Circular],
           source: [Object],
           prop: 'color',
           value: 'blue' } ],
      parent: 
       Rule {
         raws: { before: '', between: ' ', semicolon: false, after: ' ' },
         type: 'rule',
         nodes: [ [Object], [Circular], [Object] ],
         parent: 
          Root {
            raws: [Object],
            type: 'root',
            nodes: [Object],
            source: [Object],
            lastEach: 4,
            indexes: [Object] },
         source: { start: [Object], input: [Object], end: [Object] },
         selector: ':root',
         lastEach: 4,
         indexes: { '4': 1 } },
      source: 
       { start: { line: 1, column: 33 },
         input: 
          Input {
            css: ':root { --foo: { color: red };; --bar: { color: blue }; --bar-foo: { color: red }; }',
            id: '<input css 1>' },
         end: { line: 1, column: 54 } },
      selector: '--bar:',
      lastEach: 3,
      indexes: {} }

Based on stylelint/stylelint#2561

@alexander-akait alexander-akait changed the title Parse and stringify custom properties sets lose semicolon Parse and stringify lose semicolon in custom property set Jun 29, 2017
@alexander-akait
Copy link
Author

alexander-akait commented Jun 29, 2017

Also a { color: red; };; after stringify lose semicolon a { color: red; }; (seems it is related to Rule)

@ai
Copy link
Member

ai commented Jun 30, 2017

Fixed 771724c

@ai ai closed this as completed Jun 30, 2017
@ai
Copy link
Member

ai commented Jun 30, 2017

Released in 6.0.4

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