madskristensen / WebCompiler

Visual Studio extension for compiling LESS and Sass files
Other
451 stars 172 forks source link

Any way to turn off the es5 in javascript filenames? #165

Open tschlarm opened 8 years ago

tschlarm commented 8 years ago

Looks like web compiler is translating our JS in ES5 compatible JS then saving and minifying the ES5 file. That's great, however, it would be nice to not have the .es5 in the minified output filename. So it would be just siteinfo.min.js instead of siteinfo.es5.min.js.

I don't really want to update all my pages to include the es5 in all the included files.

Any option to turn off the es5 in the minified filename?

I guess I could just use your bundler/minifier extension...

ruslanurban commented 8 years ago

I checked the source code and .es5.js and, consequently, .es5.min.js are baked into the code (src\WebCompilerVsix\Commands\CreateConfig.cs and src\WebCompilerVsix\CompilerService.cs). They are used by default, if input file extension is .js.

On the other hand you can manually modify compilerconfig.json to modify the output file extension.

For example:

[
  {
    inputFile: "scripts/app.es6.js",
    outputFile: "scripts/app.js"
  }
]

It would make many of us happy if we could specify the extensions in the compilerconfig.json.defaults. That would make life easier on projects with large numbers of style and script files.

E.g.


{
    compilers: { ... },
    minifiers: { ... },
    formats : [
        es6; {
            extensions : ['.es6.js'],
            compiler : {name: 'babel', output: '.js'},
            minifier : {name: 'javascript', output: '.min.js', map: '.js.map'},
        },
        es5; {
            extensions : ['.js'],
            compiler : null,
            minifier : {name: 'javascript', output: '.min.js', map: '.js.map'},
        },
        sass; {
            extensions : ['.scss', '.sass'],
            compiler : {name: 'sass', output: '.css'},
            minifier : {name: 'css', output: '.min.css', map: '.css.map'},
        },
        css; {
            extensions : ['.css'],
            compiler : null,
            minifier : {name: 'css', output: '.min.css', map: '.css.map'},
        }       
    ]
}

In this example, someone would create an app.es6.js file which would compile into app.js and minified into app.min.js with the map file app.js.map.

On a separate note, it would be nice to nest the compiled output under the input file when the files are created.

jitbit commented 7 years ago

Any news? It's been more than a year

JuanGarassino commented 7 years ago

Has anybody find a solution for this? Thx

ruslanurban commented 7 years ago

I ended up switching to gulp-based build system.