How can Stylus be configured to require colons and semicolons? - stylus

Is there a way to limit the amount of omissions that Stylus allows? Particularly in a team environment, force the use of the pythonic layout with colons and semicolons.
I cannot find any documentation on configuring compilation.

Apparently there's no way to force this behavior when compiling with Stylus.
It's syntax is almost identical as SASS, you should consider using it.

Forcing code style is not a responsibility for Stylus. The situation with team environment to keep code style consistent is exactly why linting tools were created for and are commonly used for Javascript (ESLint, JSLint), CSS, SCSS etc.
For Stylus there is Stylint. Use it as a CLI tool, Git hook or in your Continous Integration service. There are also plugins with integrations for popular IDEs:
Atom
Sublime Text
WebStorm / PhpStorm / IntelliJ IDEA
Visual Studio Code

Related

Why use create-react-app when I can just use react in the browser?

I want to use react/redux. So I did "create-react-app test" after 5 minutes, I get a directory with 22,538 files and takes 131MB.
Meanwhile if I google, "jsfiddle react redux" and look at the first link I get a jsfiddle with just a few files it loads, all within the browser.
So why should I use create-react-app versus just loading a few dependencies in the browser? Is the overhead worth it? Is it mainly due to webpack?
I use create react app (CRA from now on) since react redux has too much boilerplate to manage things.
CRA is basically a startup-kit: that explains why has so much basic package asset in terms of import.
I can assure you that maybe you'll pay the cost to use redux on large projects (and dependencies...and packaging!!!).
Mostly depends on teams anyways, if you need to standardize how to operate on things and your team is large, Redux should be useful since this way of act avoids unexpected implementations because "there's a way" to do things.
my personal preference is not to use CRA. it was meant to be a starter kit for developers who want to learn react without wasting time on configuration and setting up the environment.
It is a fantastic learning tool if you start from scratch because all the magic is hidden from your view, you just focus on React and let cra take care of the details. but production projects are not that simple to handle. there are a lot of requirements which may come in and your cra may not support it. as it was meant to be a generic tool for learning react. you can eject it but then you should really avoid ejecting it as the config is extremely complicated.
with cra you are missing a very important base of your project. ie the webpack.
The way cra solves this problem is by hiding all the config by default, so after starting your project you are not exposed to Babel, Webpack, dev/prod environment, or any other config.
You start learning with a tool that does everything for you, but when you are ready to know how things really work under all that, what are you supposed to do?
With cra you have an eject script that can uncover all the config that is hidden beneath.
If you feel so adventurous to do it, you will find yourself into a really huge and scary config, meant to do a lot of stuff and designed to not be exposed to the end user.
if you are a senior developer then you must really try to configure your own webpack config according to your project requirement. webpack, babel, etc are very important because they are not just for react. you can use them in any modern javascript project. as a senior developer, you should really know how things are working, in case you decide to remove a library and add another you should know where and how to do it. and really should not rely on a tool that makes things simple for u.
All of this is not a hard rule to follow. but my personal experience .

IntelliJ and React which IDE/Texteditor should I choose

I am going to develop a web application with React and want know which IDE/Text Editor would fit best.
IntelliJ IDEA for example supports the framework as well as WebStorm. And now I want to know if there are differences between the support of the editors as well as the benefits for implementing with one of these 2 IDEs.
As I am familiar with IDEA I would use it, if there is no important or nice feature missing compared to WebStorm.
WebStorms features are a subset of IntelliJ IDEAs. You won't miss any that might come with WebStorm and AFAIK IntelliJ will always ship new features (updates) at the same time (or even before) WebStorm.
Further reading:
Can IntelliJ IDEA encapsulate all of the functionality of Webstorm and PHPStorm through plugins?
https://intellij-support.jetbrains.com/hc/en-us/community/posts/207461065-IntelliJ-Idea-Ultimate-vs-WebStorm

Is there any way to parse an existed css to React Native css?

I want to move my existed web app to mobile platforms. How should I transfer my existed css file to React Native css?
Is there any way to do this directly in the app logic, or I should use builders like webpack, if it so, which plugin do I need to use? Or maybe there is some packages for IDEs like Webstorm or Atom?
Any tip will be helpful, just not to do this manually.
There is nothing built into React Native to turn CSS into RN StyleSheets. React Native has a different set of attributes that is supports and some of them behave slightly different from their counterparts in CSS. That said I have a few suggestions for paths forward:
Rewrite your css as StyleSheets as Sintylapse suggested covered here
Use a third party transpiler like this one to convert yous css to React Native StyleSheets.
Write all your styles inline with no stylesheets.
I would recommend the first option if you intend to work on this app or React Native in general for a while. Though it may be a bit rough to learn the syntax and how to write your styles, in the long run you will become more proficient than you would with the other methods. If you are looking for a good place to start with stylesheets this blog post looks promising. The transpiler could work but since it is a third party project I wouldn't be surprised if you ran into a bug and had to comb through generated code to find what is wrong. Writing styles inline can help prototype but it will not make it easy to maintain your app in the long run.

'Find Usages' IDE functionality for Angularjs (Directives, Services)

I'm starting to wonder what is the best way to work with a moderately sized AngularJS project. I'm wanting to find where a directive or service is used without having to do a 'Ctrl+F' and search the project manually. Are there any IDEs that offer this feature, or does anyone have some approaches for working with these projects that they could share?
I didn't try it personally, so my answer is going to be pretty short, but I think you should look at TypeScript (http://www.typescriptlang.org/). I've seen many mentions of it being a good fit for Angular, and it allows for "Intellisense" features in IDE that should meet your needs.
Basically it means rewriting your code in an "augmented" version of JavaScript that makes your code typed and therefore should make it easier to handle a large codebase and run static analysis.
Here's some information about TypeScript support in IntelliJ, if that's your IDE: https://www.jetbrains.com/idea/help/typescript-support.html

Is there a way I can use angular-generator without yeoman?

Basically what I want is a scaffolding tool (without bower and other stuff that it comes with) and controller, service/factory generators.
Yeoman is great but I was wondering if there's anything minimalist cli out there for angular.
Well, if all you want is a base angular app structure, that is called a boilerplate. There are a few available:
https://github.com/angular/angular-seed
https://github.com/ngbp/ngbp
https://github.com/angular-app/angular-app
However, you seem to also want a controller, service/factory generator. This will always require:
some kind of task runner (like Grunt)
or an IDE that supports templates.
Since you don't seem to like grunt (grunt IS AWESOME), these IDEs might help you...
Eclipse supports template, you can find some here
IntelliJ's PHPStorm or WebStorm have a feature called Live Templates which, IMHO, are far better than eclipse. You can find some premade templates here, but is easy to roll your own, as explained in this tutorial.
If you want a command line interface but not Yeoman's, you might want to have a look at the "Generation" section of this collection. As of today, it has one option that uses Lineman and two that made their own CLI, but they use bower. Anyway, if what you're looking for exists, it should be in there somewhere.

Resources