Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add outputLessBundle option to output the intermediate bundle file #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cc-ebay
Copy link

@cc-ebay cc-ebay commented Feb 25, 2021

With this option we can check the intermediate file. With the appropriate less options we can even use the source maps.

Ex:

  {plugin: 'lasso-less', config: {
    outputLessBundle: true,
    lessConfig: {
      env: "development",
      dumpLineNumbers: true,
      sourceMap: {
        sourceMapFileInline: true
      }
    }
  }}

@DylanPiercey
Copy link
Contributor

@cc-ebay what is the use case here? This particular change is not going to mesh well with the existing lasso tooling, for example, a plugin that uploads assets to a resource server would not work with this.

@cc-ebay
Copy link
Author

cc-ebay commented Mar 2, 2021

@DylanPiercey Being able to serve the lasso.less so we have something close to the .less source. Very useful when there are a lot of mixins.

@DylanPiercey
Copy link
Contributor

DylanPiercey commented Mar 2, 2021

@cc-ebay I'm not following what the actual end goal is here though. Is this something you want for dev mode? What is special about the less generated css vs the rest of the css that you want to do something different with?

Is it just about adding source maps?

@cc-ebay
Copy link
Author

cc-ebay commented Mar 3, 2021

Yes, in dev mode you can see source maps to the bundle .less file (not the .css).

@DylanPiercey
Copy link
Contributor

Since this module is setup to (when bundling is disabled) merge all the less into a single file, this should already be possible.

Does the following by itself not work for you?

  {plugin: 'lasso-less', config: {
    lessConfig: {
      env: "development",
      dumpLineNumbers: true,
      sourceMap: {
        sourceMapFileInline: true
      }
    }
  }}

@DylanPiercey
Copy link
Contributor

Now that I am looking at it, this plugin actually does the less module concatenation to make the "single less file" and also inlines comments and such that is not going to work without modification using that sourcemap option. Even with your change to provide an option to extract the less to a different file, it would still not have the correct sourcemaps.

@cc-ebay
Copy link
Author

cc-ebay commented Mar 3, 2021

I lost the changes but after patching the plugin options here https://github.com/marko-js-archive/marko-starter-lasso/blob/master/createLassoConfig.js#L74 I was able to see the source maps related to the bundle files. It is not as good as mapping to the single source files but better than having only .css.

Does not Chrome still need to be able to load the .less from disk ?

@DylanPiercey
Copy link
Contributor

I see, if that is all you are going for then it should work to just make the config:

{
      plugin: "lasso-less",
      config: {
        lessConfig: {
          sourceMap: {
            sourceMapFileInline: true,
            outputSourceFiles: true
          }
        }
      }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants