{"action":"created","issue":{"url":"https://api.github.com/repos/jakubpawlowicz/clean-css/issues/1006","repository_url":"https://api.github.com/repos/jakubpawlowicz/clean-css","labels_url":"https://api.github.com/repos/jakubpawlowicz/clean-css/issues/1006/labels{/name}","comments_url":"https://api.github.com/repos/jakubpawlowicz/clean-css/issues/1006/comments","events_url":"https://api.github.com/repos/jakubpawlowicz/clean-css/issues/1006/events","html_url":"https://github.com/jakubpawlowicz/clean-css/issues/1006","id":298432556,"number":1006,"title":"Having a non-breaking space in css leads to error","user":{"login":"blackholegalaxy","id":11064123,"avatar_url":"https://avatars0.githubusercontent.com/u/11064123?v=4","gravatar_id":"","url":"https://api.github.com/users/blackholegalaxy","html_url":"https://github.com/blackholegalaxy","followers_url":"https://api.github.com/users/blackholegalaxy/followers","following_url":"https://api.github.com/users/blackholegalaxy/following{/other_user}","gists_url":"https://api.github.com/users/blackholegalaxy/gists{/gist_id}","starred_url":"https://api.github.com/users/blackholegalaxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackholegalaxy/subscriptions","organizations_url":"https://api.github.com/users/blackholegalaxy/orgs","repos_url":"https://api.github.com/users/blackholegalaxy/repos","events_url":"https://api.github.com/users/blackholegalaxy/events{/privacy}","received_events_url":"https://api.github.com/users/blackholegalaxy/received_events","type":"User","site_admin":false},"labels":[{"id":173406665,"url":"https://api.github.com/repos/jakubpawlowicz/clean-css/labels/bug","name":"bug","color":"e11d21","default":true},{"id":271813603,"url":"https://api.github.com/repos/jakubpawlowicz/clean-css/labels/more%20details%20needed","name":"more details needed","color":"c7def8","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jakubpawlowicz/clean-css/milestones/73","html_url":"https://github.com/jakubpawlowicz/clean-css/milestone/73","labels_url":"https://api.github.com/repos/jakubpawlowicz/clean-css/milestones/73/labels","id":3156593,"number":73,"title":"4.1.10","description":null,"creator":{"login":"jakubpawlowicz","id":24273,"avatar_url":"https://avatars3.githubusercontent.com/u/24273?v=4","gravatar_id":"","url":"https://api.github.com/users/jakubpawlowicz","html_url":"https://github.com/jakubpawlowicz","followers_url":"https://api.github.com/users/jakubpawlowicz/followers","following_url":"https://api.github.com/users/jakubpawlowicz/following{/other_user}","gists_url":"https://api.github.com/users/jakubpawlowicz/gists{/gist_id}","starred_url":"https://api.github.com/users/jakubpawlowicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakubpawlowicz/subscriptions","organizations_url":"https://api.github.com/users/jakubpawlowicz/orgs","repos_url":"https://api.github.com/users/jakubpawlowicz/repos","events_url":"https://api.github.com/users/jakubpawlowicz/events{/privacy}","received_events_url":"https://api.github.com/users/jakubpawlowicz/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":4,"state":"closed","created_at":"2018-03-02T16:19:00Z","updated_at":"2018-03-05T18:39:22Z","due_on":null,"closed_at":"2018-03-05T18:39:22Z"},"comments":26,"created_at":"2018-02-20T00:01:43Z","updated_at":"2018-03-06T09:17:42Z","closed_at":"2018-03-05T18:37:54Z","author_association":"NONE","body":"### Environment\r\n\r\nUsing clean-css through Angular CLI 1.7.0 which moved to clean-css. clean-css is imported through webpack plugin as it can seen here: https://github.com/angular/angular-cli/blob/master/packages/@angular/cli/plugins/cleancss-webpack-plugin.ts\r\n\r\n### Configuration options\r\n\r\n```js\r\n const cleancss = new CleanCSS({\r\n          compatibility: 'ie9',\r\n          level: 2,\r\n          inline: false,\r\n          returnPromise: true,\r\n          sourceMap: this._options.sourceMap,\r\n        });\r\n```\r\n\r\n### Input SCSS\r\n\r\nImage, since non-breaking space would not show up properly (screenshot taken on VSCode on faulty scss code, with Highlight bad characters VSCode plugin):\r\n\r\n![bad_char](https://user-images.githubusercontent.com/11064123/36401689-10bf3cc0-15a7-11e8-892d-10d2b93e9e48.PNG)\r\n\r\nThis code was transpiled to CSS, which still contains the non-breaking space. Resulting in following error.\r\n\r\n\r\n### Error\r\n\r\n> /project/node_modules/clean-css/lib/reader/input-source-map-tracker.js:37\r\n>   if (originalPosition.line === null && line > 1 && selectorFallbacks > 0) {\r\n> \r\n> TypeError: Cannot read property 'line' of undefined\r\n>     at originalPositionFor (/project/node_modules/clean-css/lib/reader/input-source-map-tracker.js:37:24)\r\n>     at originalMetadata (/project/node_modules/clean-css/lib/tokenizer/tokenize.js:486:43)\r\n>     at intoTokens (/project/node_modules/clean-css/lib/tokenizer/tokenize.js:435:68)\r\n>     at tokenize (/project/node_modules/clean-css/lib/tokenizer/tokenize.js:74:10)\r\n>     at fromStyles (/project/node_modules/clean-css/lib/reader/read-sources.js:147:12)\r\n>     at fromString (/project/node_modules/clean-css/lib/reader/read-sources.js:48:10)\r\n>     at doReadSources (/project/node_modules/clean-css/lib/reader/read-sources.js:33:12)\r\n>     at readSources (/project/node_modules/clean-css/lib/reader/read-sources.js:24:10)\r\n>     at /project/node_modules/clean-css/lib/clean.js:99:12\r\n>     at _combinedTickCallback (internal/process/next_tick.js:131:7)\r\n>     at process._tickCallback (internal/process/next_tick.js:180:9)\r\n\r\n### Expected behavior\r\n\r\nPresence of non-breaking space should not block the production of css since these kind of spaces should be deleted in the minification process.\r\n\r\n### Potential fix\r\n\r\nWe could add a marker for no-break space and replace the character with standard space.\r\n\r\n```\r\nNO_BREAK_SPACE: /\\u00A0|\\u202F|\\uFEFF/g,\r\n```\r\n\r\nthen in tokenize:\r\n```\r\nisNoBreakSpace = Marker.NO_BREAK_SPACE.test(character);\r\n...\r\nelse if (isNoBreakSpace) {\r\n      // Replace any kind of no-break-space with standard space\r\n      character = Marker.SPACE;\r\n      buffer.push(character);\r\n    }\r\n```\r\n\r\nCan't open a PR as I don't know how to test that in your test suit."},"comment":{"url":"https://api.github.com/repos/jakubpawlowicz/clean-css/issues/comments/370715334","html_url":"https://github.com/jakubpawlowicz/clean-css/issues/1006#issuecomment-370715334","issue_url":"https://api.github.com/repos/jakubpawlowicz/clean-css/issues/1006","id":370715334,"user":{"login":"enavarro222","id":1804076,"avatar_url":"https://avatars1.githubusercontent.com/u/1804076?v=4","gravatar_id":"","url":"https://api.github.com/users/enavarro222","html_url":"https://github.com/enavarro222","followers_url":"https://api.github.com/users/enavarro222/followers","following_url":"https://api.github.com/users/enavarro222/following{/other_user}","gists_url":"https://api.github.com/users/enavarro222/gists{/gist_id}","starred_url":"https://api.github.com/users/enavarro222/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enavarro222/subscriptions","organizations_url":"https://api.github.com/users/enavarro222/orgs","repos_url":"https://api.github.com/users/enavarro222/repos","events_url":"https://api.github.com/users/enavarro222/events{/privacy}","received_events_url":"https://api.github.com/users/enavarro222/received_events","type":"User","site_admin":false},"created_at":"2018-03-06T09:17:41Z","updated_at":"2018-03-06T09:17:41Z","author_association":"NONE","body":"thanks a lot @jakubpawlowicz  !"}}
{"actor":{"display_login":"enavarro222"}}