WordPress.org

Forums

TablePress
[resolved] Anyway to write CSS in .css file? (8 posts)

  1. navyspitfire
    Member
    Posted 1 year ago #

    Just wondering if there is anyway to write css in the .css file or if it can only be done in the "custom code" section. I'm using SASS and would really like to be able to use my variables.

    http://wordpress.org/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks for your question, and sorry for the trouble.

    Directly writing into the CSS files that TablePress uses (tablepress-custom.css, tablepress-combined.css, and tablepress-combined.min.css in wp-content) is not possible unfortunately, as that breaks the saving/minification process.
    CSS changes should therefore always be done through the "Custom CSS" textarea.

    My suggestion is that you keep your own copy of your SASS file and a compiled CSS file offline on your computer (or also in wp-content), and then copy/paste the CSS file's contents into the "Custom CSS" field after a change.
    Alternatively, you could use the available plugin filter hooks (in the function get_custom_css_location() in classes/class-css.php) and make those point to your compiled CSS file.

    (As a sidenote: I do have SASS/SCSS support on my "Ideas" list, so that this will maybe be possibile directly in TablePress in the future. That doesn't help you right now, of course. Sorry.)

    Regards,
    Tobias

  3. navyspitfire
    Member
    Posted 1 year ago #

    Thanks for the detailed response. Great plugin, btw.

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    no problem, you are very welcome! :-) I hope it helps!

    Best wishes,
    Tobias

    P.S.: In case you haven't, please rate TablePress here in the plugin directory. Thanks!

  5. navyspitfire
    Member
    Posted 1 year ago #

    Done! Thanks again.

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    thanks, I really appreciate it!

    Regards,
    Tobias

  7. Mannie Schumpert
    Member
    Posted 1 year ago #

    @navyspitfire It's more efficient to keep all your CSS in one file via your Sass workflow, then dequeue the TablePress CSS.

    add_action('wp_enqueue_scripts', 'dequeue_tablepress_style', 11 );
    function dequeue_tablepress_style(){
    	wp_dequeue_style('tablepress-default' );
    }
  8. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    a different method would also be to just use

    add_filter( 'tablepress_use_default_css', '__return_false' );

    to turn off the Default CSS. With that, "Custom CSS" could still be used, if desired.

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • TablePress
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags