我是新来的咕噜咕噜,还在学习,所以我遇到了一个非常奇怪的问题.当我运行"watch"
任务时,我的命令行被阻止,所以基本上我不能做任何事情.请记住,任务已成功完成.这是我的命令行输出:
C:\server\css-test>grunt w
Running "watch" task
Waiting...OK
>> File "compass-examples-master\02\sass\screen.scss" changed.
Running "compass" (compass) task
unchanged compass-examples-master/02/sass/ie.scss
unchanged compass-examples-master/02/sass/print.scss
overwrite compass-examples-master/02/stylesheets/new/sass/screen.css
Running "watch" task
Completed in 1.496s at Fri Mar 22 2013 19:31:37 GMT+0100 (Central Europe Standard Time) - Waiting...
Run Code Online (Sandbox Code Playgroud)
如您所见,我所做的只是运行"compass"
任务,它成功完成.
插入点在Waiting...
文本部分后保持闪烁,但键盘输入不起作用.
我的咕噜声配置
module.exports = function (grunt)
{
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
compass: {
dist: {
options: {
sassDir: 'compass-examples-master/02',
cssDir: 'compass-examples-master/02/stylesheets/new',
imagesDir: 'compas-examples-master/02/images',
boring: false,
outputStyle: 'nested',
require: 'sass-media_query_combiner'
}
}
},
watch: { …
Run Code Online (Sandbox Code Playgroud) 我目前正在阅读《你不懂 JS》。其中有一节讲的是软装订技术。基本上,它是将函数绑定到特定范围/上下文的变体。
摘自书中:
如果有一种方法可以为默认绑定提供不同的默认值(不是全局或未定义的),同时仍然让函数能够通过隐式绑定或显式绑定技术手动进行 this 绑定,那就太好了。
if (!Function.prototype.softBind) {
Function.prototype.softBind = function(obj) {
var fn = this,
curried = [].slice.call( arguments, 1 ),
bound = function bound() {
return fn.apply(
(!this ||
(typeof window !== "undefined" &&
this === window) ||
(typeof global !== "undefined" &&
this === global)
) ? obj : this,
curried.concat.apply( curried, arguments )
);
};
bound.prototype = Object.create( fn.prototype );
return bound;
};
}
Run Code Online (Sandbox Code Playgroud)
一般来说,我了解该函数的作用,除了这部分:
bound.prototype = Object.create( fn.prototype );
Run Code Online (Sandbox Code Playgroud)
为什么我们在使用这种“软绑定”技术时必须设置原型?
PHP新手在这里.我不知道这里发生了什么.
function doEcho(){
echo ' Done';
}
echo 'Status ='. doEcho();
Run Code Online (Sandbox Code Playgroud)
上面的代码将返回
DoneStatus =
Run Code Online (Sandbox Code Playgroud)
为什么"完成"在"状态"之前出现?
谢谢.
我是WordPress中的新手,我对如何在我的主页中插入一个子文件夹中的immage插入到我的主题目录中有以下疑问.
所以我有以下情况:进入我的自定义主题目录,我有以下文件夹,其中包含jpg immage:/assets/img/flexslider/flex-1.jpg
现在在我的header.php文件中我有这样的东西:
<li>
<img src="assets/img/flexslider/flex-1.jpg">
<div class="flex-caption">
<p class="flex-caption-text">
<span>Lorem ipsum</span><br>
<span>sit dolor</span><br>
<span>adipiscing elitur</span>
</p>
</div>
</li>
Run Code Online (Sandbox Code Playgroud)
显然,当我加载页面时,immage flex-1.jpg没有被加载,因为没有正确的路径(事实上使用FireBug我获得它试图加载资源/ img/flexslider/flex-1.jpg immage)所以我认为我可以使用绝对路径,但这很可怕!
所以我想使用WP提供的get_template_directory_uri()函数来执行此操作,我尝试以这种方式更改以前的代码:
<li>
<img src=<?php get_template_directory_uri().'/assets/img/flexslider/flex-1.jpg' ?>>
<div class="flex-caption">
<p class="flex-caption-text">
<span>Lorem ipsum</span><br>
<span>sit dolor</span><br>
<span>adipiscing elitur</span>
</p>
</div>
Run Code Online (Sandbox Code Playgroud)
但是不工作并且使用FireBug我可以看到没有加载任何东西,事实上我的浏览器源代码我:
<img src="">
Run Code Online (Sandbox Code Playgroud)
为什么不工作?我错过了什么?
TNX
安德里亚
我正在尝试将身份验证与next-auth
应用程序中的库集成。我一直在关注这里给出的官方教程https://github.com/nextauthjs/next-auth-example/。给定示例的问题是我需要检查每个页面上是否有一个会话需要这样的身份验证。
import { useState, useEffect } from 'react';
import { useSession } from 'next-auth/client'
export default function Page () {
const [ session, loading ] = useSession()
// Fetch content from protected route
useEffect(()=>{
const fetchData = async () => {
const res = await fetch('/api/examples/protected')
const json = await res.json()
}
fetchData()
},[session])
// When rendering client side don't display anything until loading is complete
if (typeof window !== 'undefined' && loading) return null
// …
Run Code Online (Sandbox Code Playgroud) php ×2
cmd ×1
command-line ×1
gruntjs ×1
javascript ×1
next-auth ×1
next.js ×1
node.js ×1
watch ×1
wordpress ×1