frontend

How do I create a mixin using less.js that doesn't output in the final stylesheet

只谈情不闲聊 提交于 2019-12-23 17:10:35
问题 I'm creating some mixins in my less.js stylesheets where I don't want the original mixin to appear in the final output. For example, I have a couple of rules like this: .grid1 { width: 960px; } I'm then applying it to the element or elements I want to take those values like so: .foo { .grid1; } But then my final css file has both in. What facility does Less provide for creating the original mixin without rendering it as a css rule as well? 回答1: The best answer I can come up with seems to be

Can you refer to variables with dashes in jade?

妖精的绣舞 提交于 2019-12-23 15:12:59
问题 I'm trying to do something like this in my jade template a.apply-url(href="#{apply-url}") But it's being interpreted as 'apply minus url' Is there a way I can force the interpreter to do the right thing? Or is there some way to refer to a top-level object, and put the index in quotes, like this? a.apply-url(href="#{this['apply-url']}") 回答1: I'm not all that familiar with Jade, but I have looked into it a little bit before. After playing around a while here, I was able to get this to work: a

How to make a background cover a separate div?

浪尽此生 提交于 2019-12-23 12:38:35
问题 I'm doing a site with side-menu. 30% of the screen is the menu and the rest is content. The contents of the div, I put a background image using the COVER method. I used the first example: https://css-tricks.com/examples/FullPageBackgroundImage/css-1.php However, this method works perfectly when the image occupies the entire background. As in my example, I want the same exact occupy 70% of the width, "eats" the image corners. How can I fix this? HTML: <div id="esquerda" style="width: 30%;

Change color depending on background color with Sass [duplicate]

与世无争的帅哥 提交于 2019-12-23 10:04:14
问题 This question already has answers here : Sass - Manipulate inherited property? (4 answers) Closed 5 years ago . I want to set up some sass color rules that will automatically choose the font color variable for me. I want the text color to be dependent on what color the background color of the parent div is. If div {background-color: #000; } Then div p { color: #fff; } How can this be achieved with sass? 回答1: You could use lightness() function for the background-color to determine the color

How to integrate WordPress into Webpack?

假装没事ソ 提交于 2019-12-23 04:58:09
问题 I developed a website front-end using HTML/CSS, JavaScript and Sass or Scss. I used NPM. I need to put that website into WordPress. I already installed WordPress and put that folder with all my assets(HTML/CSS, JS, Sass etc..) into theme folder. Now, what do I do now? How do I connect all of this? I know it's possible because I have worked on a site like this before at work, but not sure how to do it from the ground up. Webpack -> WordPress. I will watch the files with NPM or webpack, but the

Why do we need event.stopPropagation() in DOM? Is it bad architectural pattern?

放肆的年华 提交于 2019-12-23 03:31:55
问题 In the everyday front-end development I often use DOM as a global event bus that is accessible to every part of my client-side application. But there is one "feature" in it, that can be considered harmful, in my opinion: any listener can prevent propagation of an event emitted via this "bus". So, I'm wondering, when this feature can be helpful. Is it wise to allow one listener to "disable" all the other? What if that listener does not have all information needed to make right decision about

Cache busting: append query string or rename file?

*爱你&永不变心* 提交于 2019-12-23 02:36:41
问题 When we try to break static assets caches, there are two common ways to doing that: By appending query string like assets/file.ext?v=123abc By renaming files like assets/file.123abc.ext However after days of searching, I found that most of building tools prefer to renaming files, e.g. gulp-rev. In my view this kind of revision will generates lots of file chunks on the server: assets |_ file.a.ext |_ file.b.ext |_ file.c.ext |_ file.d.ext |... Any idea about this? 回答1: After days of searching,

How to develop rails app for shopify with ScriptTags

非 Y 不嫁゛ 提交于 2019-12-22 12:42:21
问题 I have a shopify app deployed in Heroku, developed in Rails. I need call a javascript function from any shopify store's frontend. I've read this article ( http://www.shopify.com/technology/3033852-shopify-api-update-scripttags-javascript-insertion ), but I don't understand it... Where do I have to put this code: HTTP POST http://their-shop.myshopify.com/admin/scripttags <?xml version="1.0" encoding="UTF-8"?> <script-tag> <src>http://example.com/your-awesome-script.js</src> <event>onload<

How I can render Content Object from tt_content i my extension with php in Typo3 6.1.5

别等时光非礼了梦想. 提交于 2019-12-22 09:57:56
问题 I need to render with my extension a specific content from tt_content. How can I do this? \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer ? 回答1: In Extbase extensions $this->cObj is no more available in the current scope, so you need to get it first before you can use: $cObj = $this->configurationManager->getContentObject(); $ttContentConfig = array( 'tables' => 'tt_content', 'source' => 123, 'dontCheckPid' => 1 ); $content .= $cObj->RECORDS($ttContentConfig); 回答2: You can do it from

Read POST form in Angular submitted by external websites

余生颓废 提交于 2019-12-22 09:30:34
问题 I am developing a website with Java for the backend and Angular for frontend. There is a situation when some external websites may send data to my website using POST form. For instance, ▼ General Request URL: https://myangularwebsite/ Request Method: POST ... ▼ Request Headers Content-Type: application/x-www-form-urlencoded Host: myangularwebsite Origin: https://externalwebsite Referer: https://externalwebsite/send.form?id=0 ... ▼ Form data ID: 0000000 TIME: 2017.06.04 11:53:58 SIGNATURE: ..