Giter VIP home page Giter VIP logo

Comments (11)

hzlmn avatar hzlmn commented on August 16, 2024

Hello, do you have postcss.config.js or other configuration files for postcss in your folder?
Take a look on docs for supported config types.

UPD: And also could you show please full stacktrace for exception?

from taskr.

vedam avatar vedam commented on August 16, 2024

I tried it without any other options anywhere (as described in #284), just passing the plugins (see above), and it failed.
Solved by creating a postcss.config.js-file and passing the plugins there.
Thx for your hint

from taskr.

hzlmn avatar hzlmn commented on August 16, 2024

In any case, it is not a correct behavior if you can not pass config object to postcss. Can you show your stacktrace?

from taskr.

lukeed avatar lukeed commented on August 16, 2024

Just spun up a test repo locally to try postcss without any config files. Works fine as is 🤔

exports.default = function * (task) {
  yield task.source('src/*.css').postcss({
    plugins: [
      require('autoprefixer')
    ]
  }).target('dist');
}

I'll add the stylus plugin & see what happens.

from taskr.

vedam avatar vedam commented on August 16, 2024

Hmmm, yeah 🤔 . I made a small isolated local test.

package.json

{
  "name": "test-case-css-plugins",
  "version": "0.1.0",
  "scripts": {
    "css": "taskr"
  },
  "devDependencies": {
    "@taskr/esnext": "^1.1.0",
    "@taskr/postcss": "^1.1.0",
    "@taskr/stylus": "^1.1.0",
    "@taskr/watch": "^1.1.0",
    "autoprefixer": "^7.1.2",
    "taskr": "^1.1.0"
  }
}

taskfile.js

export async function style(task) {
  await task.source('*.styl')
    .stylus({
      errors: true,
      'include css': true
    })
    .postcss({
      plugins: [
        require('autoprefixer')({
          browsers: ['last 2 versions']
        })
      ]
    })
    .target('./')
}

export default async function(task) {
  await task.watch('*.styl', 'style')
}

console:

[17:13:33] Running with /Users/acve/Sites/lab/svelte/12-testcase/taskfile.js
[17:13:33] Starting default
[17:13:33] Watching files...
[17:13:33] Finished default in 63ms
[17:13:42] File changed: reset.styl
[17:13:42] Starting style
[17:13:42] @taskr/postcss failed because Invalid PostCSS config! An object is required; recevied: object
[17:13:42] Finished style in 260ms

from taskr.

lukeed avatar lukeed commented on August 16, 2024

Also worked with Stylus attached:

exports.default = function * (task) {
  yield task.source('src/*.styl').stylus().postcss({
    plugins: [
      require('autoprefixer')
    ]
  }).target('dist');
}

Not sure where to go from here @vedam

If you keep seeing that error, please add a console.log(config) after this line inside your node_modules.

Thanks~

from taskr.

vedam avatar vedam commented on August 16, 2024

@lukeed: I've added console.log(config) and it outputs:

[17:27:05] Running with /Users/acve/Sites/lab/svelte/12-testcase/taskfile.js
[17:27:05] Starting default
[17:27:05] Watching files...
[17:27:05] Finished default in 71ms
[17:27:24] File changed: reset.styl
[17:27:24] Starting style
{ plugins: 
   [ { [Function: plugin]
       options: [Object],
       info: [Function],
       postcssPlugin: 'autoprefixer',
       postcssVersion: '6.0.8' } ] }
[17:27:25] @taskr/postcss failed because Invalid PostCSS config! An object is required; recevied: object
[17:27:25] Finished style in 259ms

I'm really sorry for the noise.
I got it running with a postcss.config.js-file and that's ok for me. I just wondered.

Thx for your help.
Maybe I'm the only one.
vedam

from taskr.

lukeed avatar lukeed commented on August 16, 2024

Interesting, it's because of @taskr/esnext!

Once the taskfile (with any options defined) is passed returned from esnext, the isObject helper doesn't consider the options an object anymore, seemingly because of its constructor? I've never heard of this before, I feel like it's a Node bug maybe??

I'll add a quick fix for postcss to adjust. It's the only plugin that uses that helper.


Not noise at all 😄 Thanks for the report

from taskr.

lukeed avatar lukeed commented on August 16, 2024

@vedam You can give taskr/[email protected] a spin 😄

from taskr.

vedam avatar vedam commented on August 16, 2024

Wow, that's fast. Ask-and-solve-on-demand.
Working here.
👏
thx vedam

from taskr.

lukeed avatar lukeed commented on August 16, 2024

Lol no problem. Thank you both~

from taskr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.