Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-57875

SCSS PHP compiler does not support the '@import url' at-rule.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.2.1
    • Fix Version/s: None
    • Component/s: HTML and CSS, Themes
    • Labels:
    • Testing Instructions:
      Hide
      1. Download the 'United' preset scss files from: https://bootswatch.com/.
      2. Use the 'import-bootswatch.php' to make a preset contained within the '/theme/boost/cli/' folder. Read 'readme_moodle.txt' within that folder for more information.
      3. Upload the preset on 'Site administration -> Appearance -> Themes -> Boost' - 'General settings' tab.
      4. Set the preset on the same tab.
      5. Observe that the preset has been parsed and applied.
      Show
      Download the 'United' preset scss files from: https://bootswatch.com/ . Use the 'import-bootswatch.php' to make a preset contained within the '/theme/boost/cli/' folder. Read 'readme_moodle.txt' within that folder for more information. Upload the preset on 'Site administration -> Appearance -> Themes -> Boost' - 'General settings' tab. Set the preset on the same tab. Observe that the preset has been parsed and applied.
    • Workaround:
      Hide

      Edit the 'head' section of the theme layout / mustache template files and add a 'style' tag with the '@import' statement.

      Show
      Edit the 'head' section of the theme layout / mustache template files and add a 'style' tag with the '@import' statement.
    • Affected Branches:
      MOODLE_32_STABLE

      Description

      With reference to: https://moodle.org/mod/forum/discuss.php?d=346241 the PHP SCSS compiler fails to parse "@import url('')" at-rule statements. It fails with a stack trace:

      [05-Feb-2017 13:39:46 Europe/London] PHP Notice:  Array to string conversion in F:\moodledev\moodle32\lib\scssphp\Compiler.php on line 2727
       
      [05-Feb-2017 13:39:46 Europe/London] Default exception handler: Exception - unknown value type: Array: line: 7 Debug: 
       
      Error code: generalexceptionmessage
      * line 3418 of \lib\scssphp\Compiler.php: Leafo\ScssPhp\Exception\CompilerException thrown
      * line 2727 of \lib\scssphp\Compiler.php: call to Leafo\ScssPhp\Compiler->throwError()
      * line 2756 of \lib\scssphp\Compiler.php: call to Leafo\ScssPhp\Compiler->compileValue()
      * line 115 of \lib\classes\scss.php: call to Leafo\ScssPhp\Compiler->compileStringContent()
      * line 1274 of \lib\scssphp\Compiler.php: call to core_scss->compileChild()
      * line 295 of \lib\scssphp\Compiler.php: call to Leafo\ScssPhp\Compiler->compileChildrenNoReturn()
      * line 194 of \lib\scssphp\Compiler.php: call to Leafo\ScssPhp\Compiler->compileRoot()
      * line 98 of \lib\classes\scss.php: call to Leafo\ScssPhp\Compiler->compile()
      * line 1216 of \lib\outputlib.php: call to core_scss->to_css()
      * line 884 of \lib\outputlib.php: call to theme_config->get_css_content_from_scss()
      * line 171 of \theme\styles.php: call to theme_config->get_css_content()
      

      where in this case 'Array: line 7' was a line in a Boost scss preset. But you will get a similar error wherever you put the code and its then parsed.

      Refs:
      https://developer.mozilla.org/en/docs/Web/CSS/[~imported]
      https://github.com/sass/libsass/issues/289

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              gb2048 Gareth J Barnard
              Participants:
              Component watchers:
              Amy Groshek, David Scotson, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Bas Brands
              Votes:
              8 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated: