SeanJM / atom-css-clean

A plugin for Atom which sorts and aligns CSS and SASS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: Cannot read property 'preferredLineLength' of undefined

RobertHosking opened this issue · comments

  1. Attempt to run CSS-clean
  2. The following error is produced:

Atom Version: 1.5.4
System: Ubuntu 15.10
Thrown From: css-clean package, v2.2.2

Stack Trace

Uncaught TypeError: Cannot read property 'preferredLineLength' of undefined

At /home/robert/.atom/packages/css-clean/main.js:1376

TypeError: Cannot read property 'preferredLineLength' of undefined
    at atom-text-editor.capture.property group.capture.sass each.capture.sass for.capture.sass import.capture.sass mixin.getValue.selector.getValue.comment block.getValue.media query.getValue.sass import.getValue.shared.nested.lines.map.value.split.map.module.exports.convert (/home/robert/.atom/packages/css-clean/main.js:1376:50)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
    at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:3:61)
    at CommandRegistry.module.exports.CommandRegistry.dispatch (/usr/share/atom/resources/app.asar/src/command-registry.js:160:19)
    at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/usr/share/atom/resources/app.asar/src/atom-environment.js:1013:28)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)

Commands

     -0:01.1.0 css-clean:convert (atom-text-editor.editor.is-focused)

Config

{
  "core": {
    "themes": [
      "one-dark-ui",
      "darker-obsidian-syntax"
    ]
  }
}

Installed Packages

# User
color-picker, v2.1.1
css-clean, v2.2.2
darker-obsidian-syntax, v1.0.2
formatter, v2.12.3
hex, v0.6.2
pigments, v0.24.4
remote-atom, v1.3.9

# Dev
No dev packages

Please include the CSS which produced the error.

Sean

On Mar 14, 2016, at 3:41 PM, Robert Hosking notifications@github.com wrote:

Attempt to run CSS-clean
The following error is produced:
Atom Version: 1.5.4
System: Ubuntu 15.10
Thrown From: css-clean https://github.com/SeanJM/css-clean package, v2.2.2

Stack Trace

Uncaught TypeError: Cannot read property 'preferredLineLength' of undefined

At /home/robert/.atom/packages/css-clean/main.js:1376

TypeError: Cannot read property 'preferredLineLength' of undefined
at atom-text-editor.capture.property group.capture.sass each.capture.sass for.capture.sass import.capture.sass mixin.getValue.selector.getValue.comment block.getValue.media query.getValue.sass import.getValue.shared.nested.lines.map.value.split.map.module.exports.convert (/home/robert/.atom/packages/css-clean/main.js:1376:50)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:260:29)
at CommandRegistry.handleCommandEvent (/usr/share/atom/resources/app.asar/src/command-registry.js:3:61)
at CommandRegistry.module.exports.CommandRegistry.dispatch (/usr/share/atom/resources/app.asar/src/command-registry.js:160:19)
at AtomEnvironment.module.exports.AtomEnvironment.dispatchApplicationMenuCommand (/usr/share/atom/resources/app.asar/src/atom-environment.js:1013:28)
at emitOne (events.js:77:13)
at EventEmitter.emit (events.js:169:7)
Commands

 -0:01.1.0 css-clean:convert (atom-text-editor.editor.is-focused)

Config

{
"core": {
"themes": [
"one-dark-ui",
"darker-obsidian-syntax"
]
}
}
Installed Packages

User

color-picker, v2.1.1
css-clean, v2.2.2
darker-obsidian-syntax, v1.0.2
formatter, v2.12.3
hex, v0.6.2
pigments, v0.24.4
remote-atom, v1.3.9

Dev

No dev packages

Reply to this email directly or view it on GitHub SeanJM/css-clean#7.

This is the shortest example. For me, it gives same error on any file.

html,
body{
    background-color: #252120;
}

.navbar-custom .navbar-brand {
    color: #777;
    font-family: "Lobster";
    font-size: 24pt;
}

hr{
    border-color: #404040;
}

p{
    font-family: 'Montserrat', helvetica, serif;
    text-align: left;
    font-size: 14pt;
    color: #FFF;
}
p.source{
    font-size: 11pt;
    text-align: right;
}
p a{
    color: #0099CC;
}
article p{
    text-indent: 50px;
}
article a{
    color: #0099CC;
}
article p,ul,iframe,h1,blockquote,span.caption,hr,img.align{
    font-size: 14pt;
    margin-left: 10em;
    margin-right: -5em; 
}

@media (max-width: 970px){
    article p,img.align,ul,iframe,span.caption,h1,hr{
        margin-left: 0em;
        margin-right: 0em; 
    }
}

@media (max-width: 970px){
    .post-heading{
        margin-top: 50px;
        text-align: center;
    }
}
@media (max-width: 970px){
    .title{
        font-size: 28pt;
    }
}
@media (max-width: 970px){
    .post-heading p,a.author{
        background-color: #404040;
        color: #F0F0F0;
        font-size: 14pt;
        text-align: center;
    }
}

@media only screen and (min-width: 768px){
    .navbar-custom .nav li a {
        color: #404040;
        padding: 20px;
}
footer{
    background-color: #404040;
}
.pager .next>a, 
.pager .next>span{
    float: none;
    background-color: #404040;
}
.subheading {
    position: absolute;
    top:
}
.post-heading h1,h2,h3,h4,h5,h6,span{
    margin-left: 0em;
    margin-right: 0em;
    text-align: center;
    font-size: 42pt;
}
.post-heading p,a.author{
    background-color: #404040;
    color: #F0F0F0;
    font-size: 14pt;
    text-align: center;
}
.post-heading{
    padding-top: 100px;
    padding-bottom: 25px;
}
.post-heading hr{
    border-color: #404040
}
h1.title{
    font-size: 48pt;
}
iframe{
    margin-right: 0em;
    margin-left: 0em;
}
.post-preview a {
    color:white;
}
.suggestion{
    height:100%;

}
.suggestion-title{
    font-family:"Roboto Condensed", sans-serif;
    color:white;
    padding-top: 1em;
    text-align:center;
    font-size: 30pt;
}
.suggestion-subtitle{
    font-family:"Roboto Condensed", sans-serif;
    color:white;
    padding-bottom: 1em;
    text-align:center;
    font-size: 30pt;
}
.centerup{
    margin-left: 0em;
    margin-right: 0em;
}

I responded prematurely. The issue is with your preferredLineLength variable not being set. I'm going to push an update.

If you can update your CSS clean and give it another try and let me know if the error still occurs, I would be more certain as to whether I did fix it.

Error no longer thrown. Thanks.

You're welcome, :)