Comments (11)
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.
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.
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.
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.
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.
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.
@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.
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.
@vedam You can give taskr/[email protected]
a spin 😄
from taskr.
Wow, that's fast. Ask-and-solve-on-demand.
Working here.
👏
thx vedam
from taskr.
Lol no problem. Thank you both~
from taskr.
Related Issues (20)
- Guide to convert Gulp plugins? HOT 5
- support native async function HOT 10
- task.source doesn't take effect after a yeild task HOT 1
- RFC: Task / Plugin Unification HOT 5
- Function option for start, serial, and parallel HOT 1
- add taskr-standard HOT 4
- excluding specific file on the task build? HOT 1
- Async Await tasks HOT 2
- `standalone` options doesn't works with @task/browserify HOT 1
- Deprecation message
- How can I mangle using this plugin ? what should I pass in options ? HOT 7
- @taskr/typescript support for tsconfig.json HOT 1
- Duplication of files (in wrong dirs) when doing multiple dir copies HOT 3
- TypeError: A value [object Object] was yielded that could not be treated as a promise. HOT 2
- Unhandled rejection TypeError: Cannot read property 'apply' of undefined
- Hi 👋 is this project still maintained somehow? HOT 2
- @taskr/pug compiler HOT 7
- Abandoned project? HOT 2
- A Strange Syntax Error HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from taskr.