{"action":"created","issue":{"url":"https://api.github.com/repos/pygy/j2c/issues/4","labels_url":"https://api.github.com/repos/pygy/j2c/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/pygy/j2c/issues/4/comments","events_url":"https://api.github.com/repos/pygy/j2c/issues/4/events","html_url":"https://github.com/pygy/j2c/issues/4","id":89409378,"number":4,"title":"At rules brain dump.","user":{"login":"pygy","id":54515,"avatar_url":"https://avatars.githubusercontent.com/u/54515?v=3","gravatar_id":"","url":"https://api.github.com/users/pygy","html_url":"https://github.com/pygy","followers_url":"https://api.github.com/users/pygy/followers","following_url":"https://api.github.com/users/pygy/following{/other_user}","gists_url":"https://api.github.com/users/pygy/gists{/gist_id}","starred_url":"https://api.github.com/users/pygy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pygy/subscriptions","organizations_url":"https://api.github.com/users/pygy/orgs","repos_url":"https://api.github.com/users/pygy/repos","events_url":"https://api.github.com/users/pygy/events{/privacy}","received_events_url":"https://api.github.com/users/pygy/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pygy/j2c/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-18T22:08:13Z","updated_at":"2015-11-16T02:27:07Z","closed_at":null,"body":"This isn't a priority at all, I'm just putting it here to get it off my mind for the moment.\r\n\r\n----\r\n\r\nGeneral remarks:\r\n\r\nCurrent support of at rules is rather *ad hoc*. It is possible to express arbitrary at-rules (except `@page`) using arrays to impose order. Currently, when processing an object, `j2c` inserts @rules after the other statements.\r\n\r\n`@font-face` is the only one to support Arrays as values. It would make sense for `@page`, `@import` and `@namespace` to do the same. For the last two, this would require a modification of `declarations`.\r\n\r\n----\r\n\r\nLet's recapitulate, quoting [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule) (almost verbatim):\r\n\r\n> - **@charset** — Defines the character set used by the style sheet. \r\n> - **@import** — Tells the CSS engine to include an external style sheet.\r\n> - **@namespace** — Tells the CSS engine that all its content must be considered prefixed with an XML namespace.\r\n\r\nIf present the former rules must happen at the beginning of the sheet, in that order.\r\n\r\n*Current status: when traversing an object, `j2c` inserts at-rules after the other statements. If you want to use these correctly, an Array is necessary to impose order. They can only take strings as parameters.*\r\n\r\nI think I can safely ignore the first two in the context of j2c. I may at some point add a special case for them.\r\n\r\n> - *Nestable at-rules* — which can be used as a statement of a style sheet as well as inside of conditional group rules:\r\n>   - @media — A conditional group rule which will apply its content if the device meets the criteria of the condition defined using a media query.\r\n>   - @supports — A conditional group rule which will apply its content if the browser meets the criteria of the given condition.\r\n>   - @document — A conditional group rule which will apply its content if the document in which the style sheet is applied to meets the criteria of the given condition. (deferred to Level 4 of CSS Spec)\r\n>   - @font-face — Describes the aspect of an external font to be downloaded.\r\n>   - @keyframes — Describes the aspect of intermediate steps in a CSS animation sequence.\r\n>   - @page — Describes the aspect of layout changes which will be applied when printing the document.\r\n>   - @viewport — Describes the aspects of the viewport for small screen devices. (currently at the Working Draft stage)\r\n\r\nThe conditional group rules are `@media`, `@supports` and `@document`. They take one or more condition then a block that contains nested statements. Sample syntax: `@media condition(s) { statements }`.\r\n\r\n*Current status: These rules are properly supported.*\r\n\r\n`@page`, `@viewport` and `@font-face` behave as rulesets. `@page` takes an initial pseudo-selector,  `@viewport` and `@font-face` don't. Then all three take a block of declarations. `@page :left { foo:bar; ...}` `@viewport {foo:bar;...}`, and `@font-face {foo:bar;...}`.\r\n\r\n*Current status: `@page` ~~isn't supported ATM~~ has been added, as well as `@viewport`. `@font-face works fine and supports arrays as values.`*\r\n\r\n`@keyframes` takes a name and a block of rulesets. The selectors of these rulesets are temporal in nature corresponding to the point in time for a given keyframe.\r\n\r\n*Current status: `@keyframes` is properly supported and animation names are \"localized\" by default. This can be overridden using the `:global()` pseudo-selector. `@-webkit-keyframes` blocks are automatically generated with properties auto-prefixed in bulk.*"},"comment":{"url":"https://api.github.com/repos/pygy/j2c/issues/comments/156891109","html_url":"https://github.com/pygy/j2c/issues/4#issuecomment-156891109","issue_url":"https://api.github.com/repos/pygy/j2c/issues/4","id":156891109,"user":{"login":"pygy","id":54515,"avatar_url":"https://avatars.githubusercontent.com/u/54515?v=3","gravatar_id":"","url":"https://api.github.com/users/pygy","html_url":"https://github.com/pygy","followers_url":"https://api.github.com/users/pygy/followers","following_url":"https://api.github.com/users/pygy/following{/other_user}","gists_url":"https://api.github.com/users/pygy/gists{/gist_id}","starred_url":"https://api.github.com/users/pygy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pygy/subscriptions","organizations_url":"https://api.github.com/users/pygy/orgs","repos_url":"https://api.github.com/users/pygy/repos","events_url":"https://api.github.com/users/pygy/events{/privacy}","received_events_url":"https://api.github.com/users/pygy/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T02:27:07Z","updated_at":"2015-11-16T02:27:07Z","body":"The missing at-rules have been added, but array handling may need some tightening/testing."}}