我正在尝试使用 Node js 在我的网站上配置 webpack,我还使用 ejs 作为视图。我尝试了很多方法来处理我的 webpack 中的 ejs,但到目前为止我还没有成功。
const path = require('path')
const nodeExternals = require('webpack-node-externals')
module.exports = (env, argv) => {
return ({
entry: {
server: './src/app.js',
},
output: {
path: path.join(__dirname, 'dist'),
publicPath: '/',
filename: 'main.js'
},
mode: argv.mode,
target: 'node',
node: {
// Need this when working with express, otherwise the build fails
__dirname: true,
__filename: true,
},
externals: [nodeExternals()], // Need this to avoid error when working with Express
module: {
rules: [
{ …Run Code Online (Sandbox Code Playgroud) 我正在设置一个新的测试,我想进行反向测试。
router = DefaultRouter()
router.register('profile', views.UserProfileViewSet, base_name='profile')
urlpatterns = [
url(r'', include(router.urls))
]
Run Code Online (Sandbox Code Playgroud)
用户配置文件视图集
class UserProfileViewSet(viewsets.ModelViewSet):
"""Handles creating, creating and updating profiles."""
serializer_class = serializers.UserProfileSerializer
permission_classes = (permissions.UpdateOwnProfile,)
authentication_classes = (TokenAuthentication,)
queryset = get_user_model().objects.all()
Run Code Online (Sandbox Code Playgroud)
所以,我想在tests.py 中做一个反转。我的镜头是:
CREAT_USER_URL = reverse('profile-create')
Run Code Online (Sandbox Code Playgroud)
我只是得到:
找不到“配置文件创建”的反向。'profile-create' 不是有效的视图函数或模式名称。
在这种情况下我应该如何设置反向。
我正在尝试使用 coveralls.io 为我的测试显示覆盖徽章,但覆盖徽章卡在“未知”上。相关的回购在这里:https : //github.com/Noah-Lc/simple-blog-rest-api 当我查看该回购的 coveralls.io 时,我看到相同的“coverage: unknown”状态:但是,个人建立被正确发送到coveralls.io:https://coveralls.io/jobs/46387537
有什么方法可以使 tsConfig 停止接受“任何”类型。我已经添加"noImplicitAny": true但仍然接受“any”作为类型。
需要 Google-AMP 工作人员的帮助。我试图在向下滚动时隐藏导航栏。如果向上滚动时再次显示它。我正在尝试隐藏标题
<nav id="navToHide">Nvabar</nav>
Run Code Online (Sandbox Code Playgroud)
AMP 动画代码我的镜头:
<amp-animation id="hideNav" layout="nodisplay">
<script type="application/json">
{
"duration": "200ms",
"fill": "forwards",
"iterations": "1",
"direction": "alternate",
"animations": [{
"selector": "#navToHide",
"keyframes": [{
"transform": "translateY(-180px)"
}]
}]
}
</script>
</amp-animation>
Run Code Online (Sandbox Code Playgroud)
AMP位置观察器代码:
<amp-position-observer on="enter:select-item1.start" layout="nodisplay"></amp-position-observer>
Run Code Online (Sandbox Code Playgroud)
我想做一些类似于导航栏在滚动时隐藏的东西。就像下面这个例子一样。 https://www.w3schools.com/howto/howto_js_navbar_hide_scroll.asp
我试图避免使用javascript