Announcement

Collapse
No announcement yet.

Caution re css compression widget - it overwrites the stylesheet.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Caution re css compression widget - it overwrites the stylesheet.

    Caution re css compression widget - it overwrites the stylesheet.

    If you install the CSS Compression Widget by importing the partial design snapshot CSSCompressionWidget-Sitexxx.acd you will overwrite your stylesheet with a default Stylesheet, any customisation or additions you have made to the stylesheet will be lost.

    To avoid this, open the Actinic Stylesheet by clicking 'Curent Stylesheet' in Design View,

    At the very very top make a new line and paste the following:

    Code:
    /* sd.widget.CSS Compression Widget.1.2:BEGIN */
    <actinic:block php="true">
    $sCSS = <<<'CSSDefinition'
    /* sd.widget.CSS Compression Widget.1.2:END */
    At the very very bottom, after everything else, make a new line and paste the following:

    Code:
    /* sd.widget.CSS Compression Widget.1.2:BEGIN */
    CSSDefinition;
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsCompressionEnabled%22%20%2f%3e">
     // Clean up CSS
     $sCSS = preg_replace('/
    |
    /', ' ', $sCSS);  // eliminate newlines
     $sCSS = preg_replace('/\s+/', ' ', $sCSS);  // convert all multiple tabs and spaces to a single space
     $sCSS = preg_replace('/\/\*.*?\*\//', '', $sCSS); // remove all comments
     $sCSS = preg_replace('/\s*(\{|\}|:|;|,|>|\/)\s*/', '${1}', $sCSS); // eliminate spaces either side of { } : ; , > /
     $sCSS = preg_replace('/([^0-9])0px/', '${1}0', $sCSS); // convert 0px to 0
     $sCSS = preg_replace('/^\s*/', '', $sCSS);  // remove spaces remaining at start of CSS
     $sCSS = preg_replace('/([^\'])#([0-9a-fA-F])\2([0-9a-fA-F])\3([0-9a-fA-F])\4/', '${1}#${2}${3}${4}', $sCSS);  // convert colours like #aabbcc to #abc
     $sCSS = preg_replace('/(padding|margin):([0-9]+(?:px|%)+) \2;/', '${1}:${2};', $sCSS); // convert margin:0 0; to margin:0;
     $sCSS = preg_replace('/(padding|margin):([0-9]+(?:px|%)+) \2 \2 \2;/', '${1}:${2};', $sCSS); // convert margin:0 0 0 0; to margin:0;
     $sCSS = str_replace(' !important', '!important', $sCSS); // remove space before !important
     $sCSS = str_replace(';}', '}', $sCSS); // get rid of trailing ; in rules
    </actinic:block>
     echo $sCSS;
    </actinic:block>
    /* sd.widget.CSS Compression Widget.1.2:END */
    It works really well, thank you Hugh! Better than this forum does. Inexplicably the forum replaces bits of code with smileys for heaven's sake. Please fix this Sellerdeck.
    Here it is as a text file:https://graphicz.solutions/csscomp.txt
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    Where can you even download these widgets as I can't find them anywhere in 18.05
    Regards

    Jason

    Titan Jewellery (Swift Design)
    Damascus Steel Rings

    Comment


      #3
      https://community.sellerdeck.com/for...gets-extension
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment


        #4
        Hmmm... Forum post not rendering html tags!
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment


          #5
          Many thanks Jonathan, I had read this a while back and thought it was for a future feature yet to be released.

          In my software I don't have a widgets tab. I do have an extensions tab but none of these new widgets are in there.
          Attached Files
          Regards

          Jason

          Titan Jewellery (Swift Design)
          Damascus Steel Rings

          Comment


            #6
            All sorted.

            I didn't realise you had to download from the Sellerdeck website. Hadn't seen this mentioned anywhere.
            Regards

            Jason

            Titan Jewellery (Swift Design)
            Damascus Steel Rings

            Comment


              #7
              Hi Jonathan, can you tell me what setup you were using? That certainly shouldn't happen, and I can't reproduce it here. I tried the following steps in a default site:

              - Copied the Smart Responsive Stylesheet layout
              - Made Smart Responsive Stylesheet (Copy) the Current Stylesheet (ie Top Level Value for the StyleSheetLayout selector)
              - Added three comments at the top, middle and bottom of the layout
              - Exported and imported the CSS Compression widget
              - The compression code was added at the top and bottom of the same layout. My three comments were still in place.
              Bruce Townsend
              Ecommerce Product Manager
              Sellerdeck Ecommerce Solutions

              Comment


                #8
                Default Swift Official v100
                Made changes to the Stylesheet.
                Executed the widget
                My changes disappeared
                Jonathan Chappell
                Website Designer
                SellerDeck Website Designer
                Actinic to SellerDeck upgrades
                Graphicz Limited - www.graphicz.co.uk

                Comment


                  #9
                  Tried it again and this time it did not overwrite... Probably worth taking a copy of the stylesheet just in case...
                  Jonathan Chappell
                  Website Designer
                  SellerDeck Website Designer
                  Actinic to SellerDeck upgrades
                  Graphicz Limited - www.graphicz.co.uk

                  Comment

                  Working...
                  X