excubo-ag / WebCompiler

Apache License 2.0
148 stars 29 forks source link

Wecompilerconfiguration issue #76

Closed KlishevichIlya closed 10 months ago

KlishevichIlya commented 10 months ago

I started working with your library. I run webcompiler -r scss -o wwwroot/styles/ and it generate .css.gz file inside output path. Firstly, it ignores _.scss files inside scss folder, secondly it uses GZip compress and I would like to get rid of that. So, I created webcompilerconfiguration.json file using webcompiler --defaults. Right now I use webcompiler -r scss -c webcompilerconfiguration.json and set GZip to false. It doesn't create any .css files inside wwwroot. How to fix that and why it doesn't work?

stefanloerwald commented 10 months ago

Both the --help flag and the Readme cover these topics extensively. Please try these first. Thanks!

KlishevichIlya commented 10 months ago

@stefanloerwald I tried using webcompiler -r scss -c webcompilerconfiguration.json but it created compiled files inside scss folder and doesn't use compilerconfig.json. In your ReadMe file there is no information how setup output files inside webcompilerconfiguration. You just added some link to dependent library and their docs doesn't cover my question. Why did you close an issue if you didn't reply how to fix my issue? What part of your readme file I should use to fix that issue? Where inside link which your provided there is an information about existing properties in webcompilerconfiguration?

stefanloerwald commented 10 months ago

You're instructing webcompiler to recursively search for files in the folder "scss", so of course it wouldn't do anything in the folder "wwwroot". You're not providing enough context for me to investigate anything here, so I can only advise to follow the Readme (which e.g. talks about how to deal with ignored paths).

KlishevichIlya commented 9 months ago

I would like to output compiled files in wwwroot, not ignore files with underscore and not use gzip. For handle gzip and ignore files I created webcompilerconfiguration.json:

{
    "Minifiers": {
        "GZip": false,
        "Enabled": false,
        "Css": {
            "CommentMode": "Important",
            "ColorNames": "Hex",
            "TermSemicolons": true,
            "OutputMode": "SingleLine",
            "IndentSize": 2
        },
        "Javascript": {
            "RenameLocals": true,
            "PreserveImportantComments": true,
            "EvalTreatment": "Ignore",
            "TermSemicolons": true,
            "OutputMode": "SingleLine",
            "IndentSize": 2
        }
    },
    "Autoprefix": {
        "Enabled": true,
        "ProcessingOptions": {
            "Browsers": [
                "last 4 versions"
            ],
            "Cascade": true,
            "Add": true,
            "Remove": true,
            "Supports": true,
            "Flexbox": "All",
            "Grid": "None",
            "IgnoreUnknownVersions": false,
            "Stats": "",
            "SourceMap": true,
            "InlineSourceMap": false,
            "SourceMapIncludeContents": false,
            "OmitSourceMapUrl": false
        }
    },
    "CompilerSettings": {
        "Sass": {
            "IndentType": "Space",
            "IndentWidth": 2,
            "OutputStyle": "Expanded",
            "RelativeUrls": true,
            "LineFeed": "Lf",
            "SourceMap": false
        },
        "Ignore": []
    },
    "Output": {
        "Preserve": true
    }
}

and also I have compilerconfig.json where I set up input, output and also ignore(as in Readme):

[
    {
        "outputFile": "./wwwroot/styles",
        "inputFile": "./scss/../*.scss",
        "CompilerSettings": {
            "Ignore": []
        },
        "minify": { "enabled": true },
        "includeInProject": true,
        "options": { "sourceMap": true }
    }
]

Then I run webcompiler -r scss -c webcompilerconfiguration.json as said in readme and it creates files inside scss instead of ./wwwroot/styles which I provided in compilerconfig.json. I didn't find any flag how set up compilerconfig.json for webcompiler

stefanloerwald commented 9 months ago

You can only have one config file

KlishevichIlya commented 9 months ago

does compilerconfig.json set up automatically when I run webcompiler -r scss? I tried webcompiler -r scss -c compilerconfig.json, but it throws an error:

webcompiler : Error reading configuration from file: The JSON value could not be converted to WebCompiler.Configuration.Config. Path: $ | LineNumber: 0 | BytePositionInLine: 1.
At line:1 char:1
+ webcompiler -r scss -c compilerconfig.json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Error reading c...itionInLine: 1.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

In docs I didn't find how setup compilerconfig.json

stefanloerwald commented 9 months ago

I think the format is outdated. The generated file is in the right format, so I recommend adjusting this to your needs

KlishevichIlya commented 9 months ago

Could you make a clue with output directory inside webcompilerconfiguration.json? I didn't find any info in dependent library which you provided in readme file. I tried

"CompilerSettings": {
        "Sass": {
            "IndentType": "Space",
            "IndentWidth": 2,
            "OutputStyle": "Expanded",
            "RelativeUrls": true,
            "LineFeed": "Lf",
            "SourceMap": false
        },
        "outputFile": "./wwwroot/styles",
        "Ignore": []
    },

but it didn't make any effectsю How setup properly outputFile directory?

stefanloerwald commented 9 months ago

https://github.com/excubo-ag/WebCompiler/blob/main/WebCompiler/Configuration/Config.cs#L23

KlishevichIlya commented 9 months ago

Wow! It helped to resolve my issue. Thanks for your help and patience, Stefan!