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

[bug] Unable to generate source maps with Sage #2189

Closed
3 tasks done
kupoback opened this issue Mar 23, 2023 · 2 comments
Closed
3 tasks done

[bug] Unable to generate source maps with Sage #2189

kupoback opened this issue Mar 23, 2023 · 2 comments
Labels
invalid This doesn't seem right

Comments

@kupoback
Copy link

Agreement

Describe the issue

When trying to run an earlier example of a similar issue, no form of suggestions in the topic generated a source map in the end. Also, while trying to mess with this, despite just before using @roots/bud, @roots/bud-tailwindcss, and @roots/sage, I am now required to install @roots/bud-sass despite before bud was compiling SCSS with no issues.

Expected Behavior

A source-map generated for the SCSS files.

Actual Behavior

Just a normal CSS file is created

Steps To Reproduce

  1. Install @roots/bud @roots/bud-tailwindcss, @roots/sage, @roots/bud-sass
  2. Create SCSS files, @import them into the main scss file
  3. Run yarn bud
  4. See the public directory just has css files.

version

6.11.0

Logs

No response

Configuration

module.exports = async (app) => {
    app
        .alias({
            "@sageAdmin": "@src/admin_assets",
            // React script alias'
            "@sageReact": "@src/react",
            "@sageRedux": "@src/react/Redux",
            "@reactComponent": "@src/react/Components",
            "@reactPages": "@src/react/Pages",
            "@reactUtil": "@src/react/Util"
        })

        .entry({
            app: ["@scripts/app", "@styles/app"],
            editor: ["@scripts/editor", "@styles/editor"],
            admin: ["@sageAdmin/css/admin_styles", "@sageAdmin/js/sage-admin"],
            sageReact: ["@sageReact/app"],
            blog: ['@sageReact/Pages/Blog/blog-index'],
        })

        .assets(["images", "fonts"])

        .watch(
            [
                "app/**/*",
                "resources/react/**/*",
                "resources/scripts/**/*",
                "resources/styles/**/*",
                "resources/views/**/*",
                "resources/vue/**/*",
            ]
        )

        .proxy("https://boilerplate8.1.test")
        .serve("http://localhost:3000")
        .setPublicPath("/app/themes/sage/public/")
        .wpjson
        .settings()
        .useTailwindColors()
        .useTailwindFontFamily()
        .useTailwindFontSize()
        .enable()
};

Relevant .budfiles

No response

@kupoback kupoback added the bug Something isn't working label Mar 23, 2023
@kellymears
Copy link
Member

I am now required to install @roots/bud-sass despite before bud was compiling SCSS with no issues.

I'm so sorry for this injustice.

Expected behavior

A source-map generated for the SCSS files.

Why did you expect that behavior?

Sage isn't configured to generate a source-map in production, only development. If you want to configure it differently you can use bud.devtool or the --devtool flag with the bud build command.

The function has 100% test coverage and works fine:

beforeEach(async () => {
bud = await factory()
bud.hooks.on = callback
method = devtool.bind(bud)
vi.clearAllMocks()
})
it(`is a function`, () => {
expect(method).toBeInstanceOf(Function)
})
it(`returns bud`, async () => {
const ret = await method()
expect(ret).toBe(bud)
})
it(`calls bud.hooks.on`, async () => {
const onSpy = vi.spyOn(bud.hooks, `on`)
await method()
expect(onSpy).toHaveBeenCalledTimes(1)
})
it(`calls bud.hooks.on`, async () => {
const onSpy = vi.spyOn(bud.hooks, `on`)
await method()
expect(onSpy).toHaveBeenCalledWith(
`build.devtool`,
`cheap-module-source-map`,
)
})
it(`calls bud.hooks.on with expected arguments`, async () => {
const onSpy = vi.spyOn(bud.hooks, `on`)
await method(callback)
expect(onSpy).toHaveBeenCalledWith(`build.devtool`, callback)
})

@retlehs retlehs added invalid This doesn't seem right and removed bug Something isn't working labels Mar 24, 2023
@kupoback
Copy link
Author

@kellymears Okay, so looking at it, I need to update my build script to run as development, and then add some filters so that it doesn't use BrowserSync. Reason I mention this is that we have development sites, and our Frontend developers need to reference SCSS files, despite it not being needed for a final production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants