# Summary

This is a preprocessor for LESS files.

I'm glad to announce about first "Less CSS Preprocessor" module - drupal 8 version.
This works with Libraries API and you can include all less libraries like in drupal 7 version. Also it works with autoprefixer (v5.0 was tested).
This module will detect yml library with "less" name.

Example:
theme_name.libraries.yml

less:
  css:
    theme:
      less_file_path/file_name.less: {}

 

and you can include it on needed pages:

Example(global use):
theme_name.info.yml

libraries:
  - 'theme_name/less'

 

This module was sponsored by:

devatwork logo

# Project URL

https://www.drupal.org/project/less

# Where is the code?

  • https://github.com/ionmacaria/less
  • https://gitlab.com/SchnWalter/drupal8-less
  • # Estimated completion date

    Unknown

    # Dependencies

    # Who's doing the port?

    https://www.drupal.org/u/ivanjaros
    https://www.drupal.org/u/corey.aufang
    https://www.drupal.org/u/sjpagan
    https://www.drupal.org/u/ionmacaria

    # What help do they need?

    This is the first version and some comments have to be reviewed.

    # D8 roadmap

    https://www.drupal.org/node/2224585

    # Background and reference information

    Unknown

    Support from Acquia helps fund testing for Drupal Acquia logo

    Comments

    legaudinier created an issue. See original summary.

    ion.macaria’s picture

    Priority: Normal » Major
    naiduharish’s picture

    Any updates on when this module will get completed?

    sjpagan’s picture

    Issue summary: View changes
    sjpagan’s picture

    Hi @naiduharish, follow #D8 Randomap to porting.

    ion.macaria’s picture

    Assigned: Unassigned » ion.macaria
    Issue summary: View changes
    Status: Needs work » Needs review
    Related issues: +#2224585: Less CSS Preprocessor: Drupal 8 version
    FileSize
    22.61 KB

    I'm glad to announce about first "Less CSS Preprocessor" module - drupal 8 version.
    This works with Libraries API and you can include all less libraries like in drupal 7 version. Also it works with autoprefixer (v5.0 was tested).
    This module will detect yml library with "less" name.

    Example:
    theme_name.libraries.yml

    less:
      css:
        theme:
          less_file_path/file_name.less: {}

     

    and you can include it on needed pages:

    Example(global use):
    theme_name.info.yml

    libraries:
      - 'theme_name/less'
    ion.macaria’s picture

    Issue summary: View changes
    ion.macaria’s picture

    Issue summary: View changes
    ion.macaria’s picture

    Issue tags: +LESS
    ion.macaria’s picture

    Issue summary: View changes
    arnoldbird’s picture

    Please include a README file in the module with instructions on installation and use. Thanks!

    frob’s picture

    I thought the porting efforts where happening here https://gitlab.com/SchnWalter/drupal8-less
    Why is porting happening in two places?

    frob’s picture

    Issue summary: View changes

    Add both places code is being done to list.

    ion.macaria’s picture

    @frob I just ported module from D7 to D8.
    https://gitlab.com/SchnWalter/drupal8-less I saw differ from D7 version.
    All efforts is Drupal 7 depelopper @corey.aufang, I just updated module code logic to Drupal 8 requirements.
    The main functionality what I needed was watch mode, and it was implemented in this version.
    Sure we can combine both versions and made a new stable version.

    Luca Cattaneo’s picture

    Thanks @ion.macaria! Your module (https://github.com/ionmacaria/less) works fine but I have the less compiled two times in style.css.

    Maybe I'm doing something wrong.
    I'm using oyejorge/less.php compiler.

    I got this warning, don't know if it's related.
    Notice: Array to string conversion in include() (line 7 of modules/contrib/less/src/Plugin/engines/LessEngineLess_php.php).

    When I clear the cache I got these others warnings.

    Notice: Undefined index: module_enabled in system_list() (line 52 of core/includes/module.inc).
    Warning: Invalid argument supplied for foreach() in _less_registry() (line 475 of modules/contrib/less/less.module).
    Notice: Undefined variable: item in _less_pre_render() (line 142 of modules/contrib/less/less.module).
    Warning: array_flip() expects parameter 1 to be array, null given in _less_pre_render() (line 142 of modules/contrib/less/less.module).
    Warning: array_flip() expects parameter 1 to be array, null given in _less_pre_render() (line 148 of modules/contrib/less/less.module).
    Notice: Undefined index: less in _less_pre_render() (line 176 of modules/contrib/less/less.module).
    Notice: Array to string conversion in include() (line 7 of modules/contrib/less/src/Plugin/engines/LessEngineLess_php.php).
    

    Thanks for your work, tell me if I can help somehow.

    frob’s picture

    I have tried both, https://gitlab.com/SchnWalter/drupal8-less is far closer to the original module rebuilt for D8. It is also the module that has had the most vetting on the module issue queue. Please read the roadmap https://www.drupal.org/node/2224585

    mmjvb’s picture

    Status: Needs review » Needs work

    With only a dev release here on d.o. Status should be Needs work.