question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I simply minify 1 file?

See original GitHub issue

I feel like i’m going crazy doing this for hours… all I want to do is literally minify 1 single file for my library. I don’t want modules, injection, or anything like that.

This is what I have so far and I’m getting (!) The emitted file "reset.css" overwrites a previously emitted file of the same name.

  {
    input: 'assets/reset.css',
    plugins: [
      postcss({
        extract: true,
        sourceMap: false,
        minimize: true,
        plugins: [],
      }),
    ],
    output: {
      file: 'dist/reset.css',
    },
  },

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
9mmcommented, Oct 10, 2020

Ahhh ok. Thanks! It’s weird rollup can’t just do something simple, I encounter the same thing with webpack. These systems are so immensely advanced and yet… minifying a single file appears to be out of the question.

1reaction
FredZengcommented, Oct 10, 2020

just ignore that warning since u know what ur doing, or u can custom handle the warning.

{
    input: 'assets/reset.css',
    plugins: [
      postcss({
        extract: true,
        modules: false,
        sourceMap: false,
        plugins: [
          require('cssnano')({
            preset: 'default',
          }),
        ],
      }),
    ],
    output: {
      file: 'dist/reset.css',
    },
    onwarn(warning, warn) {
      if (warning.code === 'FILE_NAME_CONFLICT') return
      warn(warning)
    }
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Minify - JavaScript and CSS minifier
This minifier removes whitespace, strips comments, combines files, and optimizes/shortens a few common programming patterns. And it comes with a huge test suite ......
Read more >
How to Minify Your Website's CSS, HTML & Javascript
Simply paste in your code and then click the Minify button to output the minified code. You can even download the output code...
Read more >
How to Minify CSS, JS, and HTML - KeyCDN Support
To minify CSS, JS, and HTML involves removing any unnecessary characters from within a file to help reduce its size and thus make...
Read more >
How to Minify JavaScript — Recommended Tools and Methods
UglifyJS is one of the most popular JavaScript minification tools. It can parse, minify and compress JavaScript code.
Read more >
How to Minify Your WordPress Files - DreamHost
One way you can combat this problem is through minification. This is the process of compressing certain files (such as CSS, JavaScript, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found