frontend

What is the purpose of having functions like componentWillMount in React.js?

半腔热情 提交于 2019-12-02 23:54:22
I have been writing components in React.js recently. I have never had to use methods like componentWillMount and componentDidMount . render is indispensable. getInitialState and other helper methods I wrote also come in handy. But not the two aforementioned lifecycle methods. My current guess is that they are used for debugging? I can console.log out inside them: componentWillMount: function() { console.log('component currently mounting'); }, componentDidMount: function() { console.log('component has mounted'); } Are there any other uses? componentDidMount is useful if you want to use some non

Magento external login will not create session cookie

谁说胖子不能爱 提交于 2019-12-02 22:29:23
问题 I am trying to replace a rather clumpsy ajax-login of Magento from an external site. The site uses Magento as a shop. Both the site and the magento-shop has their own logins, therefor when a user logs in it is important that both are synchronized. This was done with an ajax-call each page reload, keeping the user logged into Magento. I want to remove this so I created a check on each page reload which will do everything server-side. My problem is, the following code does not work properly: /

AngularJS routing vs backend routing

匆匆过客 提交于 2019-12-02 20:54:42
I would like to use AngularJS in my next project. The application with Python backend and html5, Angular frontend. I am going to use MVC framework on backend and I am little bit confused. Do I have to use routing on backend and also frontend? Because I always used backend routing and routing on frontend is really new idea for me. Is client side routing better? And when I choose to use frontend routing, there will be no routes on backend? All request will be send to one url? You can use client-side routing and let the backend return static files and JSON data. The routing in Angular basically

Is there a way to include partial using html-webpack-plugin?

会有一股神秘感。 提交于 2019-12-02 18:59:20
I am using Webpack to compile my scripts and HTML (using html-webpack-plugin ). The thing is, I have 5 HTML files that contains the same parts and I want to move these parts to separate .html files and then include these parts in every HTML file. This way, if I will change these smaller HTML files, it will recompile every HTML file to represent these changes. Webpack does this for .js files by default, but can I use something like that for HTML files? You can use <%= require('html!./partial.html') %> in your template. Example here: https://github.com/jantimon/html-webpack-plugin/blob/master

Tricky Button Moving Away when Mouseover in Javascript? [closed]

只愿长相守 提交于 2019-12-02 18:50:12
I remember seeing some website or script on the web about this funny / tricky button: Basically it's a button that is impossible to click. When mouseover, it moves randomly away. Can someone point me to a source or show me few line of code to do that? Preferably using jQuery. Gautam This is probably what you are looking for, http://jsfiddle.net/9CDtE/4/ HTML <button>button</button>​ CSS button{ position:absolute; top:10px; left:10px; }​ JS $(function(){ $("button").on({ mouseover:function(){ $(this).css({ left:(Math.random()*200)+"px", top:(Math.random()*200)+"px", }); } }); });​ 来源: https:/

How do I use “custom filter” prop in data tables in vuetify? or How do I create a custom filter to filter by headers?

只愿长相守 提交于 2019-12-02 18:22:15
As of date of posting, I cannot find any documentation to use the "custom filter" prop in data tables. I just want to create a custom filter to filter my data table by headers. I have a dropdown, and when user click on one of the options for the dropdown, it will filter the list for one specific header. Example: Dropdown options: Food type: fruit, meat, vegetable Bakchoi (vegetable) Pork (meat) Chicken Thigh (meat) watermelon (fruit) If I select dropdown as meat, it should only show me pork and chicken thigh. Looking at the code on Github , it looks like the customFilter prop is used to

Best way to capture JavaScript errors in production? [closed]

拟墨画扇 提交于 2019-12-02 17:35:42
I've got a serious JavaScript problem that is hard to reproduce in any of our dev/test/prod environments. Nonetheless, it is being reported consistently by our customers. Sometimes we think it's browser specific -- sometimes we think it's action specific -- sometimes we think it's cookie related. It's a tough one and we're getting pulled in too many different directions and they are all coming up short. We believe the problem occurs in one of our main JavaScript files -- but that file is enormous. We've pin-pointed other problems in the past in this file -- and guarded against future problems

Unused css - how do you clean it up?

◇◆丶佛笑我妖孽 提交于 2019-12-02 16:44:06
Probably any experienced web developer would be familiar with this problem: over time your css files can grow pretty huge and ugly because of all the no longer used selectors, which might be pretty tricky to find. I'm working on a rails project where we tend to re-design things quite frequently, which leads to a tonne of deadweight css. What's the best way to find and remove it? Now, I do know that there is a rails plugin called deadweight built specifically for that purpose. However, here's my problem with deadweight: first of all, it completely ignores selectors used in javascript. Next, it

How to deploy separated frontend and backend?

梦想与她 提交于 2019-12-02 16:24:42
I am developing a new project with react/express as the frontend and loopback as the backend api. I have separated both of them in my development environment with different ports. How should I deploy them in production? Hosting on a same server - separate the backend with a different sub-domain? Hosting on 2 different servers - seems impossible to use back the same domain. GG. I just answered a related question for AWS. You can deploy your frontend on a static hosting service and a CDN AWS S3 + AWS CloudFront Google Cloud Storage + Google Cloud CDN GitHub Pages + CloudFlare Now Surge Netlify

Testing HTML/CSS/Javascript skills when hiring [closed]

最后都变了- 提交于 2019-12-02 16:23:42
When hiring a front-end developer, what specific skills and practices should you test for? What is a good metric for evaluating their skill in HTML, CSS and Javascript? Obviously, table-less semantic HTML and pure CSS layout are probably the key skills. But what about specific techniques? Should he/she be able to effortlessly mock up a multi-column layout? CSS sprites? Equal height (or faux) columns? Does HTML tag choice matter (ie, relying too heavily on <div> )? Should they be able to explain (in words) how floats work? And what about javascript skills? How important is framework experience