simplrjs / css-to-ts Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
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, '');
}
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.