Giter Site home page Giter Site logo

modern-dev / grunt-iife Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 20 KB

:clamp: A Grunt plugin for wrapping JavaScript code in IIFEs.

Home Page: https://www.npmjs.com/package/grunt-iife

License: MIT License

JavaScript 100.00%
grunt plugin iife js javascript ecmascript function

grunt-iife's People

Contributors

brunowego avatar snyk-bot avatar virtyaluk avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grunt-iife's Issues

Small issue with grunt file

Hello @virtyaluk, you have a nice plugin here, congrats. I get small issue with grunt.file.exist, I did a research and I finding in http://gruntjs.com/api/grunt.file and the correct function is grunt.file.exists.

But I not know if this issue is because the version of grunt.

grunt iife                                                                                                                                                             
Running "iife:dist" (iife) task
Warning: grunt.file.exist is not a function Use --force to continue.

See my module:

module.exports = {
    dist: {
        files: {
            './src/scripts/chip.js': './dist/scripts/chip.js'
        }
    }
};

You can tell me where I mistake?

Indentation of code

Hello again, the result is great but not indented, the linters show errors with the indentation.

;(function() {
'use strict';

/**
 * Chip
 */

angular
    .module('xx.chip', [
        'ngSanitize'
    ]);

    ...
}());

Try check with JSHint, ESLint, JSCS...

Compression option

First of all thanks for the great Grunt plugin! We have been using it in many projects.

We currently require to modify the output manually to achieve better compression. For example, it is possible to create a IIFE using !function(){}() which would save some extra bytes.

If you would ever want to improve the plugin, I hereby want to suggest to add a compression option including unary_operator option.

!function(){ /* code */ }();   // returns true by default
~function(){ /* code */ }();   // returns -1 by default
-function(){ /* code */ }();   // returns NaN by default
+function(){ /* code */ }();   // returns NaN by default

More IIFE techniques are available on https://digitalfortress.tech/js/exclamation-mark-function-iife/

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.