SeanJM / atom-css-clean

A plugin for Atom which sorts and aligns CSS and SASS
MIT License
20 stars 2 forks source link

Uncaught TypeError: Cannot read property 'trim' of undefined #34

Closed runar-rkmedia closed 7 years ago

runar-rkmedia commented 7 years ago

This might be due to the changes in the beta-version of Atom, but I thought I would report it.

  1. SCSS-file, Clean-convert

Atom: 1.17.0-beta4 x64 Electron: 1.3.15 OS: Mac OS X 10.12.4 Thrown From: atom-css-clean package 2.19.6

Stack Trace

Uncaught TypeError: Cannot read property 'trim' of undefined

At /Users/runarkristoffersen/.atom/packages/atom-css-clean/node_modules/css-clean/src/main/capture/modules/nested.js:23

TypeError: Cannot read property 'trim' of undefined
    at nested (/packages/atom-css-clean/node_modules/css-clean/src/main/capture/modules/nested.js:23:25)
    at Object.selector (/packages/atom-css-clean/node_modules/css-clean/src/main/capture/modules/selector.js:4:11)
    at capture (/packages/atom-css-clean/node_modules/css-clean/src/main/capture/capture.js:152:25)
    at nested (/packages/atom-css-clean/node_modules/css-clean/src/main/capture/modules/nested.js:21:15)
    at Object.selector (/packages/atom-css-clean/node_modules/css-clean/src/main/capture/modules/selector.js:4:11)
    at capture (/packages/atom-css-clean/node_modules/css-clean/src/main/capture/capture.js:152:25)
    at cleanCss (/packages/atom-css-clean/node_modules/css-clean/index.js:14:19)
    at module.exports (/packages/atom-css-clean/node_modules/css-clean/index.js:23:10)
    at /packages/atom-css-clean/main.js:43:17)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:265:1)
    at /Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:3:1
    at Object.didConfirmSelection (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:106:1)
    at SelectListView.confirmSelection (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:313:1)
    at HTMLDivElement.core:confirm (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:81:1)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:265:1)
    at /Applications/Atom Beta.app/Contents/Resources/app/src/command-registry.js:3:1
    at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:610:1)
    at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom Beta.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:401:1)
    at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:100:1)
    at HTMLDocument.<anonymous> (/Applications/Atom Beta.app/Contents/Resources/app/src/window-event-handler.js:3:1)

Commands

     -1:25.9.0 core:paste (input.hidden-input)
  4x -1:22.6.0 find-and-replace:select-next (input.hidden-input)
     -1:21.4.0 core:backspace (input.hidden-input)
     -1:20.7.0 core:save (input.hidden-input)
     -1:18.9.0 command-palette:toggle (input.hidden-input)
     -1:17.4.0 core:backspace (input.hidden-input)
 15x -1:14.4.0 core:move-down (input.hidden-input)
 16x -1:10 core:move-up (input.hidden-input)
     -1:06.7.0 core:move-down (input.hidden-input)
     -1:02.7.0 core:confirm (input.hidden-input)
     -1:02.7.0 css-clean:convert (input.hidden-input)
     -0:56.3.0 settings-view:open (input.hidden-input)
     -0:53.3.0 core:confirm (input.hidden-input)
     -0:10.2.0 command-palette:toggle (input.hidden-input)
     -0:03.7.0 core:confirm (input.hidden-input)
     -0:03.7.0 css-clean:convert (input.hidden-input)

Non-Core Packages

aligner-python 1.0.1 
atom-alignment 0.12.1 
atom-beautify 0.29.23 
atom-clock 0.1.7 
atom-css-clean 2.19.6 
atom-dedupe-open-files 0.1.0 
atom-django 0.3.2 
atom-like-brackets-editor 1.1.4 
atom-reveal-file-in-finder 1.1.4 
atom-runner 2.7.1 
autocomplete-json 5.4.0 
autocomplete-python 1.8.63 
autoprefixer 3.6.1 
browser-plus 0.0.87 
browser-refresh 0.9.0 
browser-refresh-on-save 0.0.6 
busy-signal 1.4.1 
change-case 0.6.5 
color-picker 2.2.5 
cursor-history 0.10.1 
dash 1.7.1 
django-test-runner 0.5.0 
emmet 2.4.3 
enhanced-tabs 1.7.0 
expand-region 0.2.7 
expand-selection-to-quotes 0.11.0 
file-icons 2.1.4 
filecolor 0.4.0 
fold-comments 0.6.0 
git-plus 7.7.0 
gitignore-snippets 0.2.5 
golden-ratio 0.3.0 
goto 1.8.3 
highlight-line 0.12.0 
highlight-selected 0.13.1 
intentions 1.1.2 
intentions-texdoc 0.3.0 
javascript-snippets 1.2.1 
keybinding-cheatsheet 0.1.1 
language-django 0.1.1 
language-latex 1.0.0 
language-lua 0.9.11 
language-markdown 0.21.0 
language-pgsql 0.2.3 
language-restructuredtext 1.1.0 
language-sql-mysql 0.3.1 
latex-hyperclick 0.2.0 
latextools 0.8.5 
linter 2.1.4 
linter-chktex 1.3.0 
linter-csslint 1.3.4 
linter-htmlhint 1.3.3 
linter-jshint 3.0.3 
linter-jsonlint 1.3.0 
linter-pylama 0.8.17 
linter-rst 0.0.3 
linter-spell 0.13.1 
linter-spell-latex 0.9.2 
linter-ui-default 1.2.3 
lipsum 0.1.0 
lorem 1.2.1 
markdown-preview-plus 2.4.9 
markdown-writer 2.6.4 
open-in-browsers 0.0.19 
open-recent 5.0.0 
pdf-view 0.57.0 
pigments 0.39.1 
preview-inline 1.4.7 
python-indent 1.0.2 
remove-whitespace 0.2.1 
rulerz 0.4.3 
script 3.14.1 
simply-django-atom 0.0.2 
sort-lines 0.14.0 
split-diff 1.3.1 
Sublime-Style-Column-Selection 1.7.4 
swackets 0.26.0 
sync-settings 0.8.1 
tab-to-escape 0.1.0 
tabularize 0.2.5 
tail 0.1.0 
text-pastry 0.6.1 
todo-show 1.11.0 
tree-view-git-modified 0.7.2 
tree-view-git-status 1.3.1 
turbo-javascript 1.4.0 
wakatime 7.0.0 
zentabs 0.8.8 
SeanJM commented 7 years ago

Can you post your CSS file?

runar-rkmedia commented 7 years ago
$primary-dark-color: #042849;
$primary-light-color: #cbe0ff;
$primary-selected-color: #005aac;
$light-text-color: white;
$grey-text-color: #8fa8bd;
$dark-text-color: #00051c;
$light-active-color: #c5eff7 ;
$secondary-color: #26ac95;
$secondary-dark-color: #042849;
$secondary-selected-color: #1f7d6d;
$danger-color: #F9BF3B;

$burger-size: 48px;
$aside-width: 400px;
$header-height: 58px;

body,
html {
    height: 100%;
    margin: 0px;
    padding: 0;
    background-color: $primary-light-color;
}

.container-full {
    padding: 1ex 2em;
    height: 100%;
    margin: 0 1em;
}
header{
    background-color: $primary-dark-color;
    color: $light-text-color;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 990;
    width: 100%;
    height: $header-height;
    padding: 8px 20px;
}
.errormsg{
    font-size: 20px;
    // border: 2px solid $primary-dark-color;
    background-color: $danger-color;
}
.header{
    display: flex;
    justify-content: space-between;
}
.header h2,
.header h1,
.header h3,{
    display: inline;
    line-height:40px;
    margin: auto 0;
}
@media screen and (max-width: 993px) {
    h1{
        font-size: 20px;
    }
    h2{
        font-size: 16px;
    }
    h3{
        font-size: 14px;
    }
}
@media screen and (max-width: 550px) {
    .header h3,{
        display: none;
    }
}

.main, aside {
    margin-top: $header-height;
    height: calc(100% - #{$header-height});
}
.rating .glyphicon{
    margin-right: -.3em;
}
.glyphicon-refresh-animate {
    margin-right: 0.4em;
    -animation: spin 1.4s infinite ease;
    -webkit-animation: spin2 1.4s infinite ease-out;
}

@-webkit-keyframes spin2 {
    from { -webkit-transform: rotate(0deg);}
    to { -webkit-transform: rotate(540deg);}
}

@keyframes spin {
    from { transform: scale(1) rotate(0deg);}
    to { transform: scale(1) rotate(540deg);}

}
.gray-text{
    opacity: 0.8;
}
footer{
    font-size: 10px;
    margin: 20px 5px 0;
    text-align: center;
}
@import "panel";
SeanJM commented 7 years ago

This is the line that breaks it:

.main, aside {
    margin-top: $header-height;
    height: calc(100% - #{$header-height});
}
SeanJM commented 7 years ago

This is fixed the latest version. But! There is another issue you have introduced here, which I like a lot:

.header h2,
.header h1,
.header h3,{
    display: inline;
    line-height:40px;
    margin: auto 0;
}
SeanJM commented 7 years ago

Just added support for that case, where you'd get an empty line like this:

,
.header h1,
.header h2,
.header h3 {
  display     : inline;
  margin      : auto 0;
  line-height : 40px;
}