Skip to content

Add post-processor callback for less(pre-processor) generated css in browser mode #1835

Closed

Description

@cloudchen

Such as autoprefixer, which is post-processor for css text, it has to process its job before inserting css text into DOM.

Because autoprefixer does much better at adding vendor prefixer than less function feature, I use it to mitigate such kind of tedious.

Only browser mode needs this feature, other modes can be easily integrated with autoprefixer and any other post-processor.

Activity

  1. lukeapage commented on Feb 1, 2014

    @lukeapage
    Member

    I would be happy with a patch extending plugins to allow a post-processor

  2. cloudchen commented on Feb 2, 2014

    @cloudchen
    ContributorAuthor

    Add a pr for this feature.
    #1842

  3. kkartunov commented on Jul 28, 2014

    @kkartunov

    Hi, investigating #2122 lead me here...
    Anyway, luckily it looks that a simple solution works just fine(tested in latest Chrome, Opera 12.17, Safari 5.1.7).
    The workaround is:
    1.Load the .less file which should be compiled before the less.js library.
    2.Because I load the less.js with JS now I can add an event listener for the onload event. It gets fired for some reason after the processing has finished. Thus it is a post-processing hook(callback).

    The code looks:

    var less_lib = document.createElement('script');
    less_lib.src = '//bla bla whatever...less.js';
    less_lib.onload = function(e){ console.log('WORKS'); };
    document.head.appendChild(less_lib);

    Use it with care!:) Will be nice if someone confirms and different browsers are tested too.

  4. stale commented on Nov 14, 2017

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions