{"action":"created","issue":{"url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/issues/62","repository_url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension","labels_url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/issues/62/comments","events_url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/issues/62/events","html_url":"https://github.com/ThemeFuse/Unyson-Shortcodes-Extension/issues/62","id":164054443,"number":62,"title":"Thinking about a better way of doing dynamic CSS for shortcodes","user":{"login":"andreiglingeanu","id":2979628,"avatar_url":"https://avatars.githubusercontent.com/u/2979628?v=3","gravatar_id":"","url":"https://api.github.com/users/andreiglingeanu","html_url":"https://github.com/andreiglingeanu","followers_url":"https://api.github.com/users/andreiglingeanu/followers","following_url":"https://api.github.com/users/andreiglingeanu/following{/other_user}","gists_url":"https://api.github.com/users/andreiglingeanu/gists{/gist_id}","starred_url":"https://api.github.com/users/andreiglingeanu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreiglingeanu/subscriptions","organizations_url":"https://api.github.com/users/andreiglingeanu/orgs","repos_url":"https://api.github.com/users/andreiglingeanu/repos","events_url":"https://api.github.com/users/andreiglingeanu/events{/privacy}","received_events_url":"https://api.github.com/users/andreiglingeanu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/labels/help%20wanted","name":"help wanted","color":"159818"},{"url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":24,"created_at":"2016-07-06T11:24:57Z","updated_at":"2016-09-22T14:46:30Z","closed_at":"2016-07-06T13:37:30Z","body":"First, I would like to know what techniques do you really use?\r\n\r\nThe most simple one is of course using `style` attribute, like this:\r\n\r\n```php\r\n<p style=\"color: <?php echo esc_attr($atts['color']) ?>;\" >Hello, World!</p>\r\n```\r\nI would simply skip this idea because it is obvious and HTML looks very ugly.\r\n\r\n<hr>\r\n\r\nNext one, as described [here](http://manual.unyson.io/en/latest/extension/shortcodes/index.html#enqueue-shortcode-dynamic-css-in-page-head): You have to hook onto an action and then call `wp_add_inline_style` function. The problem with this is that you are committing yourself to one specific css file because of the way `wp_add_inline_style` works.\r\n\r\nWhile doing [WP-Shortcodes](https://github.com/ThemeFuse/Unyson-WP-Shortcodes-Extension), I've noticed a big problem with this. The dynamic styles for each of the shortcode you're inserting into post editor (or any `wp-editor`) won't be included.\r\n\r\nThe thing we adhered to is that `wp-editor` won't include Unyson button by default. That's because you'll have to do apply `do_shortcode` function to the result you're receiving from `wp-editor`. And also call a helper that we'll implement later that will include all the dynamic CSS.\r\n\r\nThe problem is that this will introduce two problems:\r\n\r\n1. Theme developers will have a little more work while integrating `wp-editor`\r\n2. You'll have one more `<style>` tag besides each included shortcode\r\n\r\nThe second one is most annoying.\r\n\r\nShortcodes from post editor can be handled a bit more easily -- without developer's implication.\r\n\r\n<hr>\r\n\r\nLet me know what you think about all of this.\r\n"},"comment":{"url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/issues/comments/248925231","html_url":"https://github.com/ThemeFuse/Unyson-Shortcodes-Extension/issues/62#issuecomment-248925231","issue_url":"https://api.github.com/repos/ThemeFuse/Unyson-Shortcodes-Extension/issues/62","id":248925231,"user":{"login":"dmbostan","id":5270333,"avatar_url":"https://avatars.githubusercontent.com/u/5270333?v=3","gravatar_id":"","url":"https://api.github.com/users/dmbostan","html_url":"https://github.com/dmbostan","followers_url":"https://api.github.com/users/dmbostan/followers","following_url":"https://api.github.com/users/dmbostan/following{/other_user}","gists_url":"https://api.github.com/users/dmbostan/gists{/gist_id}","starred_url":"https://api.github.com/users/dmbostan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmbostan/subscriptions","organizations_url":"https://api.github.com/users/dmbostan/orgs","repos_url":"https://api.github.com/users/dmbostan/repos","events_url":"https://api.github.com/users/dmbostan/events{/privacy}","received_events_url":"https://api.github.com/users/dmbostan/received_events","type":"User","site_admin":false},"created_at":"2016-09-22T14:46:30Z","updated_at":"2016-09-22T14:46:30Z","body":"Guys, \r\nwouldn't it be easier to generate a css file on save_post / theme options save?\r\n\r\nI mean I use the page builder mostly and do a lot of changes to sections, columns, etc.\r\n\r\nWhy not create dynamic css files on save? One for section, another for columns, based on how many shortcodes are used on a specific page. And display that specific CSS files for that specific page?\r\n\r\nOr ...\r\n\r\nadd extra option to options \r\n\r\n```array(\r\n    'type'  => 'color-picker',\r\n    'value' => '#FF0000',\r\n   ...\r\n    'in_css' => array('background-color')\r\n)```\r\n\r\nLet's parse each option and read the value and in_css. And based on this generate a dynamic css file.\r\n\r\nJust ideas :) "}}
{"actor":{"display_login":"dmbostan"}}