konitter / gulp-combine-media-queries Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
wp-content/themes/projectname/scss/main.css found.
buffer.js:167
throw new TypeError('must start with number, buffer, array or string');
^
TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:167:9)
at new Buffer (buffer.js:58:10)
at Transform.transform as _transform
at Transform._read (/Users/username/dev/projectname/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at Transform._write (/Users/username/dev/projectname/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/Users/username/dev/projectname/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/Users/username/dev/projectname/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at Transform.Writable.write (/Users/username/dev/projectname/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at DestroyableTransform.ondata (/Users/username/dev/projectname/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:583:20)
at emitOne (events.js:77:13)
Segmentation fault: 11
@Keyframes missing name near line
I downloaded and started with this error..
I found this error...
C:\xampp\htdocs\web\project\node_modules\when\lib\decorators\unhandledRejection.js:80
throw e;
^
Error: property missing ':' near line 2892:3
at error (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.js:57:15)
at declaration (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.js:1:33)
at declarations (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.js:9:19)
at rule (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.js:481:21)
at rules (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.js:103:56)
at stylesheet (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.js:736)
at module.exports (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\css-parse\index.j485:10)
at Transform.transform [as _transform] (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\index.js:3:19)
at Transform._read (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\readable-stream\b\_stream_transform.js:184:10)
at Transform._write (C:\xampp\htdocs\web\project\node_modules\gulp-combine-media-queries\node_modules\readable-streamib\_stream_transform.js:172:12)
My gulpfile.js
is:
const gulp = require('gulp'),
mmq = require('gulp-combine-media-queries');
gulp.task('stylus', function(){
gulp.src('APP/CSS/main.styl')
.pipe(plumber())
.pipe(stylus({
use:[prefixer(), rupture(), jeet()],
compress: false
}))
.pipe(mmq({log: true}))
.pipe(gulp.dest('Assets/CSS/'))
.pipe(browserSync.reload({stream:true}))
.pipe(gulp.dest('APP/CSS'));
});
In package.json
:
"devDependencies": {
"gulp-combine-media-queries": "^0.2.0"
}
And I not found a solution for this.
Can you help me? please..
Just updated to node v4 and I get "[Error: no writecb in Transform class]". I commented cmq out of the task and it ran correctly. I also reinstalled gcmq, same error.
TypeError: must start with number, buffer, array or string
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
at Function.Buffer.from (buffer.js:202:9)
at new Buffer (buffer.js:158:17)
at Transform.transform [as _transform] (/var/www/xabar-html/node_modules/gulp-combine-media-queries/index.js:152:21)
at Transform._read (/var/www/xabar-html/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_transform.js:184:10)
at Transform._write (/var/www/xabar-html/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_transform.js:172:12)
at doWrite (/var/www/xabar-html/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:237:10)
at writeOrBuffer (/var/www/xabar-html/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:227:5)
at Transform.Writable.write (/var/www/xabar-html/node_modules/gulp-combine-media-queries/node_modules/readable-stream/lib/_stream_writable.js:194:11)
at Readable.ondata (_stream_readable.js:639:20)
at emitOne (events.js:116:13)
Is it possible to write combined styles for each media query to a separate file?
If not, that would be a handy feature I guess - what do you think?
Hey,
just included this plugin into one of my projects and found out it actually can increase file size instead of minimizing it?
I donβt know why exactly this happens and how to prevent it. Maybe you can add a flag/option that authors can use in their gulpfile to not increase filesize (and then skip the optimization after comparing filesizes)?
https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
request to remove gulp-util using the following API replacements:
gutil.File => https://www.npmjs.com/package/vinyl
gutil.replaceExtension => The .extname property on Vinyl objects or https://www.npmjs.com/package/replace-ext
gutil.colors => https://www.npmjs.com/package/ansi-colors
gutil.date => https://www.npmjs.com/package/date-format
gutil.log => https://www.npmjs.com/package/fancy-log
gutil.template => https://www.npmjs.com/package/lodash.template
gutil.env => https://www.npmjs.com/package/minimist
gutil.beep => https://www.npmjs.com/package/beeper
gutil.noop => https://www.npmjs.com/package/through2
gutil.isStream => Use the .isStream() method on Vinyl objects
gutil.isBuffer => Use the .isBuffer() method on Vinyl objects
gutil.isNull => Use the .isNull() method on Vinyl objects
gutil.linefeed => Use the string '\n' in your code
gutil.combine => https://www.npmjs.com/package/multipipe
gutil.buffer => https://www.npmjs.com/package/list-stream
gutil.PluginError => https://www.npmjs.com/package/plugin-error
I have something like this
@media only screen and (max-width: 940px) {
.test {
background-color: red;
}
@media (min-resolution: 144dpi) {
.test {
background-color: green;
}
}
}
@media (min-resolution: 144dpi) {
.test {
background-color: yellow;
}
}
but this gets converted to
@media (min-resolution: 144dpi) {
.test {
background-color: yellow;
}
}
@media only screen and (max-width: 940px) {
.test {
background-color: red;
}
}
so I'll lose my nested media rules :(
Hi!
There is a bug with @imports.
Example file style.less
:
@import url(http://fonts.googleapis.com/css?family=Titillium+Web:600);
and nothing happens, output is empty.
Gulp task I'm using:
gulp.task('style', function () {
gulp.src(source.css + '/style.less')
.pipe(less({ sourceMap: true }))
.on('error', gutil.log)
.pipe(gulp.dest(assets.css))
.pipe(browserSync.reload({ stream: true }))
.pipe(rename({ suffix: '.min' }))
.pipe(less())
.on('error', gutil.log)
.pipe(cmq())
.pipe(csso())
.pipe(gulp.dest(assets.css))
});
In style.css
@imports exists, but in style.min.css
@imports ripped out.
If I comment .pipe(cmq())
β @imports comes back.
I love the idea here, but I've put a lot of effort into ensuring my source maps work properly. And unfortunately this plugin does not handle them. It throws the media query styles after any source map info right now (the bottom of the file).
For the record, from my tests, the plugin works as expected. For now, I'm just going to move this to a final production build step.
Some thoughts on where to go with this... https://github.com/ai/autoprefixer currently handles this situation. They get CSS piped to them, they look for current source maps, then modify the source map depending on what changes autoprefixer makes, then re-inline the source map. It looks like the author even made a library to help post process css: https://github.com/ai/postcss. Maybe you could leverage his efforts there to make your life easier?
And I found your plugin from this post from yeoman by Addy Osmani. So you may be picking up some more traction.
When css-parse encounters an error it throws a new Error object which is not caught in index,js:125
This causes the watch workflow in Gulp to crash due to an unhandled error and is also resulting the .on('error') event not to be triggered.
Please look at some options to catch the error and throw a PluginError instead?
It would be nice to be able to exclude certain breakpoints when exporting to an external file.
Example use:
In [src].css I want to combine media queries for mobile landscape (eg. up to 40em), but don't want them to be exported in a separate file. Whereas [src].responsive.css would only contain media queries for tablet and desktop (40em and up).
The why here is Mobile First, where tablet & desktop styling is being served as a separate file. The plugin already does a great job at facilitating this workflow, but I'd hate to give up styling mobile landscape...
the gulp plugin should just feed the css into this module and receive out new css. this will clean up the code base a lot and let other people use the code for other build systems
I have some strange behavior after combining queries. Look at those images:
See the sequence has broken. My task is:
gulp.task('sass', function() {
return gulp.src('sass/**/*.s+(a|c)ss')
.pipe(sass())
.pipe(cmq())
.pipe(gulp.dest('css'))
});
Why this can be? I don't know what I'm doing wrong.
CSS declarations targeting mozilla browsers are removed by the plugin:
@-moz-document url-prefix() {
...
}
empty pseudo content gets a space added. Dealbreaker for me unfortunately (pretty cool otherwise!)
content: "";
becomes
content: " ";
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.