Giter VIP home page Giter VIP logo

css-to-ts's People

Contributors

deividasbakanas avatar dovydasnavickas avatar giedriusgrabauskas avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

deividasbakanas

css-to-ts's Issues

Class names can be generated with special characters

I ran into a bug and tried to fix it but I can't create branches here... and I'm not going to fork this so I'll just explain and paste the code fix here.

Basically if you run the following command:
css-to-ts --rootDir \"./src\" --outDir \"./src\" --pattern \"**/*.css\" --suffix css --delimitter .

the input file will be something like app.css and the output file will be app.css.ts which is very nice. What isn't nice is the contents of the typescript file...

export var App.Css = `.ranking-app {
  text-align: center; }
`;

which isn't valid typescript (can't create a variable with a special character in the name).

Fix:
In cli-handler.ts use this method instead

    private snakeCaseToCamelCase(fileName: string) {
        let regex = /(\w*)(\-*)/g;
        let camelCaseWithSpecialCharacters = fileName.replace(regex, (match: string, word: string, delimitter: string) => {
            return word.charAt(0).toUpperCase() + word.substr(1).toLowerCase();
        });
        return camelCaseWithSpecialCharacters.replace(/[^0-9a-z]/gi, '');
    }

@types dependencies should be in dev-dependencies

Currently in the package.json there are several @types/ dependencies in the dependencies section. These should be moved to the dev-dependencies section so that they don't get resolved when people install the package via npm.

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.