Giter Site home page Giter Site logo

Comments (4)

olback avatar olback commented on May 27, 2024

I don't really know what you're asking? Your code shouldn't get converted. Just minified. const or let doesn't get converted to var and so forth. Also, the file I think you're referring to should be named .uglifyrc and not .unifyrc unless you changed it in settings.

from es6-css-minify.

martonx avatar martonx commented on May 27, 2024

Sorry, yes uglifyrc.

Here you are one example:

const CACHE = 'v1';

self.addEventListener('install', event => {
    self.skipWaiting();

    event.waitUntil(
        caches.open(CACHE).then(cache => {
            return cache.addAll([
                '/',
                '/manifest.json',
                '/fonts/fontello/css/fontello.css'
            ]);
        })
    );
});

self.addEventListener('fetch', event => {
    //Using cacheFirst methodology
    event.respondWith(fromCache(event.request));
    event.waitUntil(update(event.request));
});

function fromCache(request) {
    return caches.open(CACHE).then(cache => {
        return cache.match(request).then(matching => {
            return matching;
        });
    });
}

function update(request) {
    return caches.open(CACHE).then(cache => {
        return fetch(request).then(response => {
            return cache.put(request, response);
        });
    });
}

And this is minified to this:
const CACHE="v1";function fromCache(e){return caches.open(CACHE).then(t=>t.match(e).then(e=>e))}function update(e){return caches.open(CACHE).then(t=>fetch(e).then(n=>t.put(e,n)))}self.addEventListener("install",e=>{self.skipWaiting(),e.waitUntil(caches.open(CACHE).then(e=>e.addAll(["/","/manifest.json","/fonts/fontello/css/fontello.css"])))}),self.addEventListener("fetch",e=>{e.respondWith(fromCache(e.request)),e.waitUntil(update(e.request))});

Ah and yes, you're right, it was my mistake I checked minified code contains functions instead of arrow syntax, but this is ok. By the way, how can I use shorten function names in minified code. For example 'fromCache' should be only 'a'?

from es6-css-minify.

olback avatar olback commented on May 27, 2024

By the way, how can I use shorten function names in minified code. For example 'fromCache' should be only 'a'? That's a setting. I changed the default so that it doesn't mangle them anymore.

from es6-css-minify.

olback avatar olback commented on May 27, 2024

You also asked for the documentation. Here are the sources i use:
clean-css
uglify-es

from es6-css-minify.

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.